| Contents: | Main | Chapter | See Also: | Getting Started Manual | Advanced User Manual | |||
The developer can write an M OUTPUT transform to convert internal data values to a different external form. Use the variable Y (not X, as used with INPUT transforms).
NOTE: Due to concatenation, do not use IF, FOR, or QUIT statements when defining OUTPUT transforms. Also, any variables you introduce within an OUTPUT transform (but not Y) should be NEWed.
To reverse the above example, suppose you wanted always to display the name field with a space character following the comma, even though the space is not stored. You could do something like this:
Figure 405: OUTPUT Transform—Sample Code
S Y=$P(Y,",")_", "_$P(Y,",",2,9)
In addition to containing M code setting Y, OUTPUT transforms can consist of a computed expression. For example, if you wanted always to display the month and year from a DATE/TIME field called FOLLOW-UP, you could write:
Figure 406: OUTPUT Transform—Sample Code with Computed Expression
MONTH(FOLLOW-UP)
Reviewed/Updated: May 2026