Introductory report exercise
Checks data and totals before printing.
Overview
A report needs data selection, presentation and aggregation rules. TReport organizes reports, sections, cells and totals; these details need not obscure the first calculation test. In this editorial exercise, visit two fictional rows, display each quantity and total them; expect 5. When implementing printing, map title, columns and totals to the selected component. This is console preparation rather than a TReport implementation or validated print output. (TOTVS, n.d., refs. 1–2)
Commented example
#Include "Protheus.ch"
User Function Ed372()
Local aQuantities := {2, 3}
Local nIndex
Local nTotal := 0
// Validate totals before adding layout and printer.
For nIndex := 1 To Len(aQuantities)
ConOut(cValToChar(aQuantities[nIndex]))
nTotal += aQuantities[nIndex]
Next nIndex
ConOut("Total: " + cValToChar(nTotal))
Return NilRows 2 and 3; total 5. Generates no file, PDF or spool. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Define filters and units before aggregating real data. Separate calculation evidence from visual print verification.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.