KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using Project Methods to Return Values to a Quick Report
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: December 6, 2002

Compatibility: Version 6.7.x and 6.8.x

4th Dimension's Quick Report Editor allows Project Methods to be called in order to process data while printing.

4th Dimension's Quick Report Editor allows formulas to be placed "behind" columns in order to process data while printing. These formulas are inserted using the formula editor dialog. That dialog allows a formula consisting of a single line of code. If you need to execute multiple lines of code, for example a conditional statement, you can place the code in a Project Method, and call that project method from the Quick Report.

The project method will use $0 to return a value to the report as each row prints. To accomplish
this, only 2 steps are required :
- Create a project method.
- Insert a column in the quick report and type the method name into the formula editor dialog

The method will now be called for each row that prints returning a value to the Quick Report for that row.

For example, suppose you were printing a report of invoices in which you wanted to clearly show those invoices that were receivable. In this scenario the Invoice table has a Boolean field titled "Paid". The paid field would print the string "True" or "False" in the quick report. The code for the method "QRIncvReceivable" shown below would be used to return the string "Receivable" for each unpaid invoice, or a null string for those invoices that had been paid, making for a more readable report:


  `QRInvcReceivable

C_TEXT($0)

Case of
 : (Not([Invoices]Paid))
  $0:="Receivable"

 Else
  $0:=""
End case