DIALOG operator
The DIALOG operator creates an action that opens a form in interactive view as a value-input dialog.
Syntax
DIALOG target
[formActionOptions]
[{initActionOperator}]
[DO actionOperator [ELSE elseActionOperator]]
Where target is one of two forms — the named-form opens a previously declared form, attaching an objSpec to each form object:
formName [OBJECTS objName1 objSpec1, ..., objNameN objSpecN]
and the class-form opens the list or edit form of a class, with one implicit object whose objSpec is attached directly:
classFormType className objSpec
Each objSpec is:
[= expr [NULL]] [inputHead [alias] [NULL] [TO propId] [CONSTRAINTFILTER [= changeExpr]] [LIST listExpr]]
Where inputHead is one of two forms — the input form returns the chosen value:
INPUT
and the input-with-write-back form additionally writes it to a property:
CHANGE [= changeExpr] [NOCONSTRAINTFILTER] [NOCHANGE]
And formActionOptions is any combination of the following options, in any order:
FILTERS filterExpr1, ..., filterExprM
windowType
manageSessionType
sessionScopeType
cancelType
READONLY
CHECK
Where windowType is one of:
FLOAT
DOCKED
EMBEDDED
POPUP
IN containerName
Description
The DIALOG operator creates an action that opens the specified form for value input: every object marked with INPUT or CHANGE returns its last current value when the form closes. The OBJECTS block sets initial values for the form's objects (in the class-form, the per-object spec attaches directly to the class and plays the same role for the form's only object, which is implicitly named object and serves as the default alias and as the parameter name inside FILTERS and DO expressions). Inside formActionOptions, the FILTERS clause attaches additional filters computed from the calling context; the remaining options control the form-opening behavior — layout, session, system-action visibility, and other modifiers. The trailing block {initActionOperator} runs once when the form is opened.
When the user closes the form via the OK action (System.formOk[]), the chosen object values are returned; via the Drop action (System.formDrop[]), NULL values are returned. In both cases the input is completed successfully, and actionOperator runs with the returned values bound to the corresponding alias parameters. When the user closes the form any other way (System.formClose[]), the input is canceled and elseActionOperator runs instead.
The operator runs synchronously (waits for the form to close) whenever the input result is consumed downstream — when a DO/ELSE continuation is given, or when at least one object has CHANGE without NOCHANGE (the implicit write-back is in effect). Otherwise the synchronization mode is inferred from the calling context (the same heuristic as for the WAIT/NOWAIT option of SHOW) and may still come out synchronous, for example when the dialog is opened from an already-modal form.
Parameters
-
formNameForm name. Composite ID.
-
classFormTypeType of the class form to open. It is specified by one of the keywords:
LIST— the selection (list) formEDIT— the editing form
-
classNameName of the custom class whose list or edit form is opened. Composite ID.
-
objName1, ..., objNameNNames of form objects. Simple IDs.
-
exprExpression whose value is used as the initial value of the form object the enclosing
objSpecis attached to. -
NULLafter the initial valueKeyword. Allows the passed initial value to be
NULL. By default, if any passed value isNULL, the action is skipped and control passes to the next action. Automatically enabled if anINPUT/CHANGEinput marker is specified for the object. -
initActionOperatorContext-dependent action operator that runs on form opening, after the form's
EVENTS ON INIThandlers. -
actionOperatorContext-dependent action operator that runs after the user closes the form successfully. The
aliasparameters added by the per-objectINPUT/CHANGEmarkers are visible inside this action. -
elseActionOperatorContext-dependent action operator that runs if the user cancels the input. The
aliasparameters added by the per-objectINPUT/CHANGEmarkers are not visible inside this action.
Input options
-
INPUTKeyword. Marks the object as returning its last current value at form close. The returned value is bound to the local parameter
aliasand is also made available to theactionOperatorof theDOclause. -
CHANGEKeyword. Like
INPUT, but additionally writes the returned value back to a property. By default the written-to property is the one supplied as the initial value (expr); to use a different one, givechangeExprafterCHANGE. Also, by defaultCHANGEadds a filter to the form so that only those object values are selectable that would not break any existing constraint when assigned. -
NOCONSTRAINTFILTERKeyword. Disables the constraint-respecting filter that
CHANGEadds by default. -
NOCHANGEKeyword. Suppresses the write-back; the returned value is bound to
aliasbut no property is updated. Use to get theCHANGEconstraint-filter behavior without the implicit assignment. -
aliasName of the local parameter that the returned value is bound to. Simple ID. Defaults to the form object's name.
-
NULLin theINPUT/CHANGEmarkerKeyword. Allows the user to return
NULLvia the Drop system action (System.formDrop[]). Enabled by default afterCHANGE; otherwise disabled by default. -
propIdID of the property that the returned value is written to (
INPUTform), or that the value is also written to in addition to theCHANGEtarget. The property is invoked at no parameters. -
CONSTRAINTFILTERKeyword. Enables the constraint-respecting filter described under
CHANGE. AfterINPUTthe filter is off by default andCONSTRAINTFILTERturns it on. AfterCHANGEthe filter is on by default, so the keyword keeps it on — including whenNOCONSTRAINTFILTERwas also given, in which caseCONSTRAINTFILTERre-enables the filter. ThechangeExprsets the property used by the filter, and withCHANGEthis same property also replaces theCHANGEtarget (a single property is shared between the constraint check and the write-back). -
listExprExpression that produces a property restricting the rows the user can pick: only rows for which the property's value is not
NULLare selectable. Evaluated in the extended input context, so it can reference the input aliases introduced byINPUT/CHANGEon this and earlier objects. TheLISToption may be specified for at most one object across the whole call.
Options
-
filterExpr1, ..., filterExprMNon-empty list of expressions that define additional filters applied to the form. Each expression can use both the calling context parameters and the form's own objects.
-
windowTypeThe form layout:
FLOATshows the form as a floating window,DOCKEDas a tab in the system forms window,EMBEDDEDandPOPUPas in-place editors, andINplaces the form insidecontainerName— a form-qualified design component (the form's name followed by the component's path within that form's design) that must be a container.FLOATis the default. -
manageSessionTypeOverrides whether the opened form is the session owner. One of:
MANAGESESSION— force ownershipNOMANAGESESSION— force non-ownership
By default, the form is the session owner only if the session has no other owner at opening time.
-
sessionScopeTypeThe session in which the form is opened. One of:
NEWSESSION— a new top-level sessionNESTEDSESSION— a new nested sessionTHISSESSION— the current session (default)
-
cancelTypeOverrides whether the Cancel system action (
System.formCancel[]) is shown on the form. One of:CANCEL— force visibleNOCANCEL— force hidden
By default, it is shown if the form is the session owner and the form contains actions that can change the session.
-
READONLYKeyword. If specified, the form is opened in read-only mode.
-
CHECKKeyword. If specified, when the user presses the OK system action (
System.formOk[]), the platform first validates the pending session changes (runs the apply pass — constraints, aggregations, event handlers — without committing); the dialog closes only if the validation passes, otherwise it stays open.
Examples
FORM selectSku
OBJECTS s = Sku
PROPERTIES(s) id
;
testDialog () {
// open a form for value input; show 'On Init' on opening, react to the chosen value on OK
DIALOG selectSku OBJECTS s INPUT {
MESSAGE 'On Init';
} DO {
MESSAGE 'Selected sku : ' + id(s);
}
}
sku = DATA Sku (OrderDetail);
changeSku (OrderDetail d) {
// input with write-back: pick a sku, the picker filters out values that would break constraints
DIALOG selectSku OBJECTS s = sku(d) CHANGE;
// equivalent to the previous line spelled out via INPUT
DIALOG selectSku OBJECTS s = sku(d) INPUT NULL CONSTRAINTFILTER DO {
sku(d) <- s;
}
}
// list form of the Sku class instead of a named form
selectAnySku () { DIALOG LIST Sku INPUT s DO MESSAGE 'sku selected'; }