| Contents: | Main | Chapter | See Also: | Getting Started Manual | Advanced User Manual | |||
ScreenMan COMPUTED fields, like Form-only fields, are fields that are defined only on the form. You cannot place COMPUTED fields from VA FileMan files on a form, because the M code for those fields often directly references data in files, which is outside the context of ScreenMan's transaction.
When you define a ScreenMan COMPUTED field, you enter a computed expression. The computed expression has the following format:
M code that sets the local variable Y
For example:
Figure 224: ScreenMan Forms—Computed Fields: Example of Format
S:$D(FLAG) Y=$P(MYVAR,",",2)_" "_$P(MYVAR,",")
The computed expression can reference any of the following used elsewhere on the form:
If the user changes the value of a field used in a computed expression, ScreenMan automatically recalculates and repaints the COMPUTED field.
The expression atom that identifies other form elements has a syntax that uses curly braces ({}) as described in Table 76.
In the formats in Table 76:
Table 76: ScreenMan Forms—Syntax for Computed Expression Atom that References a DD Field
| Format | Explanation | |
| {Field;Opt_spec} | The value of Field is retrieved.
An Opt_spec (optional specifier) can be used to retrieve the internal, rather than the external form: |
|
| ;I | Retrieve the Internal form of the Field value. | |
| {Pfield:Field;Opt_spec} | Pfield is a POINTER to a file. The value of Field in that file is retrieved. The Opt_spec value of ;I can be used as described immediately above to retrieve the internal, rather than the external form. | |
| {Field_1;Opt_spec1: File:Field_2;Opt_spec} | Field_1 is not a POINTER field. The value
of Field_1 is used to do a lookup into File. Field_2 from that file is
retrieved.
An Opt_spec value of ;I can be used to retrieve the internal rather than the external form. In addition, you can control how the lookup is done by using any of the following optional specifiers for Opt_spec1:
|
|
| ;I | Use the Internal form of the field value for the lookup | |
| ;IX(xref list) | Use specific IndeX(es) in the lookup. (For example ;IX(B^C) specifies that the B and C index should be used.) If this specifier is not used, all indexes starting with the B index are used in the lookup. | |
A computed expression atom can also reference Form-only fields and COMPUTED fields used on the form.
In the formats listed in Table 77:
REF: For a description of the format of "Form_only," see the description of "Syntax for Pointer Link—Navigating Via Form Only Fields."
Table 77: ScreenMan Forms—Syntax for Computed Expression Atom that References a Form-only Field
| Format | Explanation | |
| {FO(Form_only);Opt_spec} | The value of Form-only is retrieved.
An Opt_spec (optional specifier) can be used to retrieve the internal, rather than the external form. |
|
| ;I | Retrieve the Internal form of the Form_only field. | |
| {FO(Pform_only: Field;Opt_spec} | Pfield_order is a POINTER-type Form-only
field that points to a file. The value of Field in that file is
retrieved.
The Opt_spec value of ;I can be used as described above to retrieve the internal, rather than the external form. |
|
| {FO(Form_only);Opt_spec1 :File:Field_2;Opt_spec} | Form_only is a Form-only field that is
not a POINTER-type Form-only field. The value of Field_order is used
to do a lookup into File. Field_2 from that file is retrieved.
An Opt_spec value of ;I can be used to retrieve the internal, rather than the external form. In addition, you can control how the lookup is done by using any of the following optional specifiers for Opt_spec1: |
|
| ;I | Use the Internal form of the field value for the lookup | |
| ;IX(xref list) | Use specific IndeX(es) in the lookup. (For example ;IX(B^C) specifies that the B and C index should be used.) If this specifier is not used, all indexes starting with the B index are used in the lookup. | |
Figure 225: ScreenMan Forms—Referencing Form-only and Computed Fields: Example
S Y="The value is: "_{NUMERIC}
S:$D(var)#2 Y="The value is: "_{NUMERIC}
S Y={LAST NAME}_","_{FIRST NAME}
S Y={NAME}_" "_{NAME:SSN}
S Y={FO(PRICE)}*1.085
S Y={FO(NAME):NEW PERSON:SSN}
Reviewed/Updated: May 2026