| Contents: | Main | Chapter | See Also: | Getting Started Manual | Advanced User Manual | |||
A developer can enter an executable line of M code at any point where one would normally be allowed to use the computed expression syntax.
REF: For more information on computed expression syntax, see the "Computed Expressions" section in the VA FileMan Advanced User Manual.
The Computed-Expression M code must create a variable X, which is understood to be the value of its computation.
NOTE: Because of concatenation, IF, FOR, and QUIT statements are not recommended in M computed expressions.
A Computed Date has CD in the Field Specifier. The X value created by the code should look like the numerical internal form of a Date, or a NULL string if the computation results in no legal date.
A COMPUTED POINTER has Cp in the Field Specifier, followed immediately by the file number of the pointed-to. The X value created by the code should look like the numerical internal entry number of an entry in that file, or a NULL string if the computation results in no legal POINTER value.
A Computed Multiple has Cm in the Field Specifier. The code should create a value X several times, once for each Multiple. Then, in the same loop, it should EXECUTE DICMX. DICMX exists at the time the code is used. The code should also create a variable D each time. Executing DICMX can result in D being KILLed, in which case the code should quit its loop.
NOTE: A M Computed Expression should be written so that more code can be concatenated to the end of it. IF statements, QUIT commands, and FOR loops should not appear. For an expression of any complexity, the best form to use is:
Create a Computed Pointer from the (fictitious) PATIENT (#2) file to the NEW PERSON (#200) file pointing at the last user who edited the patient:

Create a Computed Date that gives the patient's next birthday:
Reviewed/Updated: May 2026