inm logo
Corporate Website | Contact | Store | Support | Login  

View categorized listing of all common frequently asked questions.
View our categorized library of downloads for all necessary manuals, software, etc.
 Article Options
Support Center » Knowledgebase » INM V12 Database for Director » Printing data from a V12 Database file
Support Page Banner
 Printing data from a V12 Database file
INM V12 Database for Director Windows, Macintosh Third parties Versions 1.x-3.x


There are two popular ways to print from Director movies:

- Directly print Director's stage with the PrintFrom Lingo command. This is very easy to implement and does not require an additional Xtra. However, it simply prints Director's stage and thus prints at 75 or so dots-per-inch.

- Use the PrintOMatic Xtra (see PrintOMatic is available for MacOS, Windows 3.11 and Windows 9x/NT. It doesn't have an interactive page design tool: page layouts must be scripted in Lingo.


How to use PrintOMatic with INM V12 Database

First, initialize PrintOMatic as you normally would, and print the required titles, texts, tables, etc. A typical PrintOMatic initialization script is:

global doc
set doc = new(xtra "PrintOMatic")
newPage doc -- add a new page
Then, if you want to print the content of a specific V12 Database field at the current coordinates location of PrintOMatic, call V12 Database's mGetField method followed by PrintOMatic's append method. Example:

set x = mGetField(gT, "FirstName")
append doc, x, FALSE
If you want to print an entire selection, call mGetField in a loop (mGetSelection cannot be of much help).

repeat with i = 1 to mSelectCount(gT)
set prod = mGetField(gT, "FirstName")
append doc, prod & RETURN, FALSE
end repeat

If you want to compute a function (e.g., number of items, sum, average, product, mean, standard deviation, etc.), initialize a Lingo variable and keep updating it in your loop. Example: to compute the average price of all the products in a selection:

set n = mSelectCount(gT)
set total = 0
repeat with i = 1 to n
set prc = mGetField(gT, "price")
append doc, prc & RETURN, FALSE
set total = total + prc
end repeat
append doc, "Total=" & total & RETURN, FALSE
append doc, "Average=" & total/n & RETURN, FALSE

To print multiple columns with PrintOMatic, you must first create frames in your document. For example, to print a list of products along with their corresponding prices (prices must obviously right-adjust), you would write a script similar to the following:

on PrintProdAndPrice
   set doc = new(xtra "PrintOMatic")
   newPage doc -- add a new page

   -- products frame is 200 pixels wide, 600 pixels tall
   newFrame doc, Rect(0,0,200,600), FALSE
   repeat with i = 1 to mSelectCount(gT)
      mGo(gT, i)
      set prod = mGetField(gT, "prodName")
      append doc, prod & RETURN, FALSE
   end repeat
   -- prices frame is 50 pixels wide, 600 pixels tall
   newFrame doc, Rect(200,0,250,600), FALSE
   setTextJust doc, "right" -- right-align column
   repeat with i = 1 to mSelectCount(gT)
      mGo(gT, i)
      set price = mGetField(gT, "prodName")
   append doc, price & RETURN, FALSE
   end repeat
   printPreview doc -- or, to print: print doc
   set doc=0
end PrintProdAndPrice

It is very convenient, with PrintOMatic, to first preview your page before printing it.

To preview a page, call:
printPreview doc

To print a document, call:
print doc

Article Details
Article ID: 112
Created On: 26 Sep 2006 02:40 PM

 This answer was helpful  This answer was not helpful

inm general footer
Services Xtras Go Products Support Gallery Store Download About Us Contact Newsroom