Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Introductory report exercise

Checks data and totals before printing.

Introductory report exerciseAdvPL
01 · OVERVIEW

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)

03 · PRACTICAL EXAMPLE

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 Nil
Expected result

Rows 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.

BEST PRACTICES
  • 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.

Related content

REFERENCES
  1. TOTVS. TReport, introdução e estrutura do componente. TDN. Accessed on 2026-10-26.
  2. TOTVS. Estruturas de controle de fluxo. TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha