Built-In Reporting
Using the Report Formatter, the developer lays out the application’s reports. The Report Formatter automatically generates and places all the code structures necessary to produce the reports. It also provides print preview for the reports.

The compiled report structure, and the print engine become part of the application executable. There is no pause necessary to load an external reporting tool, and all parts of the report therefore are compiled and run very quickly.
The following describes how Clarion executes a report, the division of labor between the print engine and the application code, plus the order in which the print engine processes the different sections of the report. Usually, the source code need only contain the report data structure, plus the appropriate data definitions and a print statement. The report data structure is generated by the Report Formatter, based on the visual editing of the developer, or by the layout generated by the Application Wizard., The Application Generator generates code to handle the the file I/O and the actual printing.
The report data structure contains all the information necessary for formatting and printing each report page. It may contain five substructures: form, header, detail, footer, and break. Each break structure can contain its own header, nested break, detail, and footer. This structure makes it possible to produce printed output in virtually any form desired. Typically, the nested details are used to print data from child tables, i.e., a record from the parent is printed, and following that, the data from the child is printed before printing the next parent record.
The toolbox lets the developer quickly specify the appearance and content of the text on each control within the report.
The Clarion reporting engine can process data procedurally or as an SQL result set. This provides an enormous amount of flexibility for the developer, who can implement counters and create procedural logic based on this fact. Report break sections and subtotals, for example, are easy to process.
When the developer is through using the visual tools to customize the appearance of the report, the Report Formatter saves it as a report structure, and the report procedure contains the code necessary to retrieve the data and loop through the table or filtered record set, and print each line of the report.
The report data structure for the report illustrated above appears below. The entire declaration was generated by the report formatter:
Report REPORT,AT(500,4115,7500,5875),PRE(RPT),FONT('Courier',10,,FONT:regular,CHARSET:ANSI),THOUS
HEADER,AT(500,500,7500,3583),USE(?unnamed)
IMAGE('Alstroemeria.jpg'),AT(5677,52,1600,1800),USE(?Image1),CENTERED,#ORIG(?Image1)
STRING('Header'),AT(1740,21),USE(?IHeader),TRN,FONT(,,COLOR:White,,CHARSET:ANSI),#ORIG(?String40)
LINE,AT(2927,344,1458,0),USE(?Line1),COLOR(COLOR:Black),LINEWIDTH(10),#ORIG(?Line1)
IMAGE('Alstroemeria.jpg'),AT(94,52,1600,1800),USE(?Image2),CENTERED,#ORIG(?Image2)
STRING('INVOICE'),AT(1979,10,3375,323),USE(?String35),CENTER,FONT('Courier New',20,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String35)
STRING(@s20),AT(1979,542,3375,240),USE(COM:Name),CENTER,FONT('Courier',15,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String5)
STRING(@s35),AT(1979,781,3396,219),USE(COM:Address),CENTER,FONT('Courier',12,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String6)
STRING(@s35),AT(1979,1031,3396,219),USE(LOC:CCSZ),CENTER,FONT('Courier',12,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String7)
STRING(@P(###) ###-####P),AT(1979,1250,3396,219),USE(COM:Phone),CENTER,FONT('Courier',12,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String8)
BOX,AT(83,1927,7198,333),USE(?Box1),ROUND,LINEWIDTH(2),#ORIG(?Box1)
STRING('Product SKU'),AT(104,3354,1000,198),USE(?String17),TRN,#ORIG(?String17)
STRING('Product Description'),AT(1094,3354,2083,198),USE(?String18),TRN,#ORIG(?String18)
STRING('Quantity'),AT(5521,3354,729,198),USE(?String20),TRN,RIGHT(50),#ORIG(?String20)
STRING('Extension'),AT(6500,3354,781,198),USE(?String21),TRN,RIGHT(50),#ORIG(?String21)
LINE,AT(83,3563,7229,0),USE(?Line3),COLOR(COLOR:Black),LINEWIDTH(2),#ORIG(?Line3)
STRING('BackOrder'),AT(3729,3354,708,198),USE(?String36),TRN,#ORIG(?String36)
STRING('Price'),AT(4896,3354,406,198),USE(?String19),TRN,#ORIG(?String19)
STRING('Invoice #'),AT(177,1969,1073,240),USE(?String15),TRN,FONT('Courier',12,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String15)
STRING('Order Date:'),AT(3625,1969,1167,240),USE(?String33),TRN,FONT('Courier',12,,FONT:bold,CHARSET:ANSI), |
#ORIG(?String33)
STRING(@d1),AT(4833,1979,729,177),USE(ORD:OrderDate),TRN,CENTER,#ORIG(ORD:OrderDate)
STRING(@n07),AT(1271,1979,729,177),USE(ORD:InvoiceNumber),TRN,CENTER,#ORIG(ORD:InvoiceNumber)
GROUP('Sold to'),AT(83,2375,3365,823),USE(?SoldTo),BOXED,TRN,#ORIG(?Group1)
STRING(@s35),AT(208,2604,3083,167),USE(GLOT:CustName),#ORIG(GLOT:CustName)
STRING(@s45),AT(208,2771,3125,167),USE(GLOT:CustAddress),#ORIG(GLOT:CustAddress)
STRING(@s40),AT(208,2927,3000,167),USE(GLOT:CusCSZ),#ORIG(GLOT:CusCSZ)
END
GROUP('Ship to'),AT(3938,2375,3365,823),USE(?ShipTo),BOXED,TRN,#ORIG(?Group2)
STRING(@s35),AT(4063,2604,2948,167),USE(GLOT:ShipName),#ORIG(GLOT:ShipName)
STRING(@s45),AT(4063,2771,3125,167),USE(GLOT:ShipAddress),#ORIG(GLOT:ShipAddress)
STRING(@s40),AT(4063,2927,3125,167),USE(GLOT:ShipCSZ),#ORIG(GLOT:ShipCSZ)
END
LINE,AT(83,3302,7229,0),USE(?Line2),COLOR(COLOR:Black),LINEWIDTH(2),#ORIG(?Line2)
END
detail DETAIL,AT(,,,240),USE(?detail)
STRING('Lines'),AT(21,21),USE(?ILines),TRN,#ORIG(?String43)
STRING('Line'),AT(73,31),USE(?ILine),TRN,#ORIG(?String42)
STRING(@n7),AT(5635,52,635,167),USE(DTL:QuantityOrdered),RIGHT(100),#ORIG(DTL:QuantityOrdered)
STRING(@s10),AT(115,42,896,167),USE(PRO:ProductSKU),#ORIG(PRO:ProductSKU)
STRING(@s35),AT(1083,52,2677,167),USE(PRO:Description),#ORIG(PRO:Description)
STRING(@n$10.2B),AT(5500,10,135,52),USE(DTL:Discount),TRN,HIDE,#ORIG(DTL:Discount)
CHECK,AT(3969,42,250,177),USE(DTL:BackOrdered),#ORIG(DTL:BackOrdered)
STRING(@n$10.2),AT(4552,52,771,167),USE(PRO:Price),DECIMAL(250),#ORIG(PRO:Price)
STRING(@N*10.2),AT(6396,52,865,167),USE(ExtendPrice),RIGHT,#ORIG(?String16)
STRING(@n$10.2B),AT(5635,10,63,52),USE(DTL:TaxPaid,,?DTL:TaxPaid:2),TRN,HIDE,#ORIG(DTL:TaxPaid)
STRING(@n$14.2B),AT(5406,21,83,52),USE(DTL:TotalCost),TRN,HIDE,#ORIG(DTL:TotalCost)
END
detail1 DETAIL,AT(,,,1167),USE(?detail1)
LINE,AT(83,10,7229,0),USE(?Line4),COLOR(COLOR:Black),LINEWIDTH(2),#ORIG(?Line4)
STRING('Footer'),AT(52,31),USE(?IFooter),TRN,#ORIG(?String41)
STRING('NOTE: Product on Back-Order will be available in 4 days.'),AT(10,396,3750,240),USE(?NoteString), |
CENTER,FONT('MS Sans Serif',10,,),#FREEZE,#ORIG(?String41)
STRING('Sub-total:'),AT(4854,156,1073,198),USE(?String23),TRN,LEFT(50),FONT(,,,FONT:bold),#FREEZE, |
#ORIG(?String23)
STRING(@N*10.2),AT(6417,146,865,208),SUM,USE(ExtendPrice,,?ExtendPrice:2),TRN,RIGHT(20),TALLY(detail), |
#FREEZE,#ORIG(?String36)
STRING('Discount:'),AT(4865,375,781,167),USE(?String24),LEFT(50),#FREEZE,#ORIG(?String24)
STRING(@N*10.2),AT(6417,333,865,208),SUM,USE(DTL:Discount,,?DTL:Discount:2),RIGHT(20),TALLY(detail), |
#FREEZE,#ORIG(DTL:Discount)
STRING('Tax:'),AT(4865,573,760,167),USE(?String27),LEFT(50),#ORIG(?String27)
STRING(@N*10.2),AT(6417,531,865,208),SUM,USE(DTL:TaxPaid),RIGHT(20),TALLY(detail),#FREEZE,#ORIG(DTL:TaxPaid)
LINE,AT(6229,740,1083,0),USE(?Line5),COLOR(COLOR:Black),LINEWIDTH(2),#ORIG(?Line5)
STRING('Total:'),AT(4854,771,948,198),USE(?String30),TRN,LEFT(50),FONT(,,,FONT:bold),#FREEZE, |
#ORIG(?String30)
LINE,AT(6229,1052,1080,0),USE(?Line6),COLOR(COLOR:Black),LINEWIDTH(2),#ORIG(?Line6)
LINE,AT(6229,1010,1083,0),USE(?Line7),COLOR(COLOR:Black),LINEWIDTH(2),#ORIG(?Line7)
STRING(@N*10.2),AT(6417,802,865,167),SUM,USE(DTL:TotalCost,,?DTL:TotalCost:2),TRN,RIGHT(20),TALLY(detail), |
#FREEZE,#ORIG(DTL:TotalCost)
END
FOOTER,AT(500,10021,7500,271),USE(?unnamed:2)
STRING('Thank You For Your Order, Please Call Again.'),AT(10,31,7438,208),USE(?String22),CENTER, |
FONT('Courier',12,,FONT:bold,CHARSET:ANSI),#ORIG(?String22)
END
|