| Contents: | Main | Chapter | See Also: | Getting Started Manual | Advanced User Manual | |||
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:
The Input Transform (Syntax) [DIITRAN] option of the Utility Functions [DIUTILITY] menu allows those with Programmer access to customize the M code in automatically generated INPUT transforms. It also lets you create INPUT transforms for other field types. In the Input Transform (Syntax) [DIITRAN] 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 DATA TYPE field value is VARIABLE POINTER, X contains the value in internally stored format (i.e., "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 in Figure 402:
Figure 402: INPUT Transform—Sample Code
INPUT TRANSFORM: K:$L(X)>30!($L(X)<3) X Replace K
With S:X[", " X=$P(X,", ")_","_$P(X,",",2) K
Replace <Enter>
S:X[", " X=$P(X,", ")_","_$P(X,", ",2) K:$L(X)>30!($L(X)<3) X
Unlike the M code for the OUTPUT Transform, 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 [DIMODIFY] option. A data dictionary listing shows 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 developer using this option.
For FREE TEXT fields, you can also indicate the maximum output length in the Input Transform (Syntax) [DIITRAN] option. The value you enter does not affect the length of data that can be entered and stored for the field; that length remains under the control of the INPUT transform code. Only the length output in VA FileMan generated reports is affected. Figure 403 shows a field defined with a maximum (input) length of 30, but an output length of only 10. The Print example shows the truncation of the 20 entered characters to 10.
Figure 403: INPUT Transform—Maximum (Output) Length
Select OPTION: UTILITY FUNCTIONS <Enter>
Select UTILITY OPTION: INPUT TRANSFORM (SYNTAX) <Enter>
Modify what File: ZZD TEST1// <Enter> (7 entries)
Select FIELD: SHORTENED TEXT <Enter>
SHORTENED TEXT INPUT TRANSFORM: K:$L(X)>30!($L(X)<1) X
Replace <Enter>
'HELP'-PROMPT: Answer must be 1-30 characters in length.
Replace <Enter>
XECUTABLE 'HELP': <Enter>
MAXIMUM LENGTH OF 'SHORTENED TEXT': (1-250): 30// ? <Enter>
THIS MAXIMUM WILL BE USED FOR OUTPUT PURPOSES, BUT WILL NOT BE PART OF THE INPUT
CHECK FOR THE FIELD.
MAXIMUM LENGTH OF 'SHORTENED TEXT': (1-250): 30// 10 <Enter>
Select OPTION: ENTER OR EDIT FILE ENTRIES <Enter>
Input to what File: ZZD TEST1// <Enter> (7 entries)
EDIT WHICH FIELD: SHORTENED TEXT <Enter>
THEN EDIT FIELD: <Enter>
Select ZZD TEST1 NAME: `5 <Enter> Second Entry from ScreenMan
SHORTENED TEXT: 12345678901234567890 <Enter>
Data is 20 characters.
Select OPTION: PRINT FILE ENTRIES <Enter>
Output from what File: ZZD TEST1// <Enter> (7 entries)
Sort by: <Enter>
First Print FIELD: .01 <Enter> NAME
Then Print FIELD: SHORTENED TEXT <Enter>
Then Print FIELD: <Enter>
Heading (S/C): ZZD TEST1 List// <Enter>
DEVICE: <Enter> TELNET Right Margin: 80// <Enter>
ZZD TEST1 List MAR 29,2016@08:58 PAGE 1
SHORTENED
NAME TEXT
----------------------------------------------------------------
Another ScreenMan
Entry from ScreenMan
First entry
ScreenMan #3
Second Entry from ScreenMan 1234567890
Output data is 10 characters.
Second entry (2)
Third entry MORE THAN
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 [DIVERIFY] 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 can 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 the Verify Fields [DIVERIFY] option would report the entry as invalid.
To help the Verify Fields [DIVERIFY] 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. For example:
Figure 404: INPUT Transform—Checking for Variables
I $G(DIUTIL)'="VERIFY FIELDS"
The Verify Fields [DIVERIFY] option does not execute the INPUT transform for the following field types:
Reviewed/Updated: May 2026