MVC structures: fields, properties and triggers
Separates Model and View metadata before defining rules.
Overview
FWFormStruct provides metadata structures for Model (type 1) or View (type 2). Its bSX3 block receives a field identifier and returns a logical inclusion decision. Selecting View fields does not replace a Model validation rule; a trigger needs a defined event, source, target and effect. The example only creates a Model structure for fictional dictionary-registered ZZ1 and selects ZZ1_COD. It neither defines a real trigger nor builds a complete application; additional properties and signatures require their class documentation. (TOTVS, n.d., ref. 1)
Commented example
#Include "Protheus.ch"
User Function Ed369()
Local oStructure
// Requires ZZ1 and ZZ1_COD in the test dictionary.
oStructure := FWFormStruct(1, "ZZ1", {|cField| AllTrim(cField) == "ZZ1_COD"})
Return oStructureStructure object for the prepared context; no persistence or View activation. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Do not confuse presentation metadata with business rules. Preserve the caller object lifecycle.
- 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.