VA FileMan V. 22.0 Programmer Manual Banner


 

Main Chapter Getting Started Manual Advanced User Manual

Advanced File Definition

INPUT Transform


An INPUT transform is M code for a particular field that is executed to determine if the data for that field is valid.

The M code for some field types' INPUT transforms is automatically generated when you create the field (this is the case for Free Text, Numeric, Date/time, Computed, MUMPS, and screened Pointer field types).

The Input Transform option of the Utility Functions submenu allows those with programmer access to customize the M code in automatically generated INPUT transforms. It also lets you create input tranforms for other field types. In the Input Transform option, when you select the field, you see an M statement that validates the variable X and kills it if it is invalid. Here, X usually contains the user's response that is being validated. If the field is a variable pointer data type, X contains the value in internally stored format - that is, 'record_number;storage_root'.

You can rewrite this line of code to meet individual requirements. If desired, the code can transform X by resetting it to another value to be filed. An example would be a name transform that deletes an extraneous space character following a comma as shown below:

    INPUT TRANSFORM: K:$L(X)>30!($L(X)<3) X    Replace K 
    With S:X[", " X=$P(X,", ")_","_$P(X,",
",2) K 
    Replace 
    S:X[", " X=$P(X,", ")_","_$P(X,", ",2) K:$L(X)>30!($L(X)<3) X 


Unlike the M code for OUTPUT transforms, you can use the IF, FOR, and QUIT commands in the M code for INPUT transforms.

Once an INPUT transform has been created for a field, the syntax checking that the field performs can no longer be modified using the Modify File Attributes option. A data dictionary listing will show XXXX for such a field.

For a computed field, the INPUT transform is simply the M code that is executed whenever the field is computed. Hence, a computed field calculation can be edited by a programmer using this option.

INPUT Transforms and the Verify Fields Option

INPUT transforms are ordinarily executed before data is filed (in which case the INPUT transform expects data in external form, not yet filed). But the INPUT transform is also executed by VA FileMan's Verify Fields option (in which case the data being checked is in internal form, and already filed). Some parts of your INPUT transform may not be compatible with data in its internal form or when the data is already filed. For example, you may check to make sure a field's value is not stored in a cross-reference before you file it; once you file the entry, however, the field value does exist in the cross-reference and Verify Fields would report the entry as invalid.

To help the Verify Fields option report fewer invalid values in this situation, the Verify Fields option sets the variable DIUTIL to "VERIFY FIELDS" when it is running. You can then check for this variable in your custom INPUT transform and skip any checks that would not be compatible with data that is in its internal form or already filed. New/Updated with VA FileMan V. 22.0

For example:

    I $G(DIUTIL)'="VERIFY FIELDS"

The Verify Fields option does not execute the INPUT transform for the following field types:

 


Reviewed/Updated: March 10, 2007