Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Trigger executing a report

Field event → prepare context → explicit action → report

Separates a field event from report execution.

Trigger executing a reportAdvPL
01 · OVERVIEW

Overview

SX7 represents rules triggered by field events. It is not a confirmed-save event: editing may repeat or be cancelled. This editorial workflow recommends preparing data in the trigger and running reports through an explicit action after context validation. The example only demonstrates a pure title-building function without registering SX7 or printing. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

Field event → prepare context → explicit action → report
03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed462()
    Local cDoc := "ED0001"
    Local bTitle := {|cCode| "Document: "+AllTrim(cCode)}
    // Local transformation without calling a printing routine.
    ConOut(Eval(bTitle,cDoc))
Return Nil
Expected result

Builds a title with a fictional document; no report is triggered. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • For automatic output, document idempotency, cancellation, expected return and caller permissions.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. Waterloo Ferreira da Silva. AdvPL — O Manual, versão 1.0; p. 94. Referência histórica.
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