Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Entry-point returns and validation

Matches return type and effect to the actual caller.

Entry-point returns and validationAdvPL
01 · OVERVIEW

Overview

Before choosing Return, inspect how the master consumes it: validation Boolean, button array, replacement text or ignored result. MVC BUTTONBAR uses an array while validation events use Booleans; this is not a universal rule for all entry points. Check transaction timing and repeated event delivery too. The exercise is a synthetic consumer accepting only Booleans, not an entry point or a universal .T. template. (Sources: refs. 1–2.)

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed626()
    Local xResponse := .T.
    Local lAccepted := .F.
    // Synthetic consumer: this exercise requires a Boolean.
    If ValType(xResponse) == "L"
        lAccepted := xResponse
    EndIf
    ConOut(lAccepted)
Return Nil
Expected result

Produces .T. for Boolean input. This particular consumer would reject strings and arrays. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Do not trigger irreversible integrations from validation that may run repeatedly.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Pontos de entrada MVC: eventos e contratos. Accessed on 2026-10-27.
  2. Atilio. dan-atilio/AdvPL. Exemplos/Vídeo Aulas/023 - Pontos de Entrada em MVC/MATA070_pe.prw. Arquivo completo consultado; adaptação editorial. Accessed on 2026-10-27.
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