Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

TRSection, TRCell and TRFunction

Connects report sections, cells and totals.

TRSection, TRCell and TRFunctionAdvPL
01 · OVERVIEW

Overview

TRSection organizes data, TRCell defines a cell and TRFunction binds calculations such as COUNT/SUM to a cell and printing scope. Counting rows differs from summing values. The fragment adapts the community COUNT binding, assuming an existing cell and implemented print cycle. Construction does not establish data processing. For Excel table output, TRSection requires a title and the definition takes precedence over visual changes during printing. (Sources: refs. 1–4.)

03 · PRACTICAL EXAMPLE

Commented example

// Fragment: oSection already contains CODIGO; does not start printing.
Local oTotal := TRFunction():New(oSection:Cell("CODIGO"),,"COUNT")
// Verify update timing and scope within the section cycle.
Expected result

Defines a cell-bound COUNT; no numeric total has been measured. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Test empty data, groups and break scope. Do not sum identifier codes as monetary amounts.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. TRSection. Construtor e saída Excel. Accessed on 2026-10-28.
  2. TOTVS. TRCell. Accessed on 2026-10-28.
  3. TOTVS. TRFunction. New e escopos. Accessed on 2026-10-28.
  4. Atilio. dan-atilio/AdvPL. Maratona de Exemplos/Exemplo_505_Classes_TReport_TRFunction_TRSection_e_TRCell.prw. Arquivo completo analisado; adaptação editorial. Accessed on 2026-10-28.
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