VA FileMan V. 22.2 Programmer Manual Banner


 

Main Chapter Getting Started Manual Advanced User Manual

Advanced File Definition

Computed Expressions


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.

Computed Dates

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.

Computed Pointers

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.

22.2Computed Multiples

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:

Examples
Example 1

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:

Figure 391: Computed Expressions—Computed Pointers: Sample Dialog Creating a Computed Pointer from File #2 to File #200; Pointing at Last User Who Edited Patient: Field #10000 in File #2

Sample dialog creating a COMPUTED POINTER from file #2 to file #200.

Example 2

Create a Computed Date that gives the patient's next birthday:

Figure 392: Computed Expressions—Computed Dates: Sample Dialog Creating a Computed Date that Gives the Patient's Next Birthday: Field #662000 in File #2

Sample dialog creating a Computed Date for next birthday.

 


Reviewed/Updated: May 2026