VA FileMan V. 22.0 Getting Started HTML Manual Banner


 

Main Chapter Getting Started Manual Programmer Manual

Computed Expressions


Where to Use Computed Expressions "On-the-Fly"

"On-the-Fly" Computed Expressions

In addition to permanently storing a computed expression in a data dictionary, there are several places within VA FileMan's dialogue where you can use a computed expression "on-the-fly:"


"PRINT FIELD:" Prompt

Whenever, you are within the Print or Search File Entries options, you are asked:

 FIRST PRINT FIELD:

OR

 THEN PRINT FIELD:

You can answer with a computed expression. For example:

 FIRST PRINT FIELD: SEX_" "_RELIGION;"";L33

This computed expression will return the contents of the SEX and RELIGION fields separated by a space. Notice that you can follow the computed expression with print qualifiers: ;"" to suppress the column heading and ;L33 to indicate that the COMPUTED field length can be 33 characters long.

A user with programmer access can also enter M code at this prompt. The M code must have a WRITE statement for anything that is to be written to the report.


"SEARCH FOR FIELD:" Prompt

In the Search File Entries option, you can answer the

 SEARCH FOR FIELD:

prompt with a computed expression.

If the expression is Boolean (i.e., its value is either true or false), you won't be asked the condition of the search, because the computed expression itself specifies that condition.

A user with programmer access can also enter M code at this prompt. The M code must set the variable X to whatever is to be compared against the search value.


"SORT BY:" Prompt

In Print or Search File Entries options, you can answer the

 SORT BY:

prompt with a computed expression. If you use a Boolean computed expression, you won't be asked for the "START WITH" parameters.

A user with programmer access can also enter M code at this prompt. The M code must set the variable X to the sort value.

Thus, if you want to print a list of the names of all patients who are Baptists, you could enter:


Select OPTION: PRINT FILE ENTRIES 

OUTPUT FROM WHAT FILE: PATIENT
SORT BY: RELIGION="BAPTIST"
WITHIN RELIGION="BAPTIST", SORT BY: FIRST PRINT FIELD: NAME

This is a common way to select certain records for printing.


22.2"Start with" and "Go to" SORT values
In Print or Search File Entries options, if the SORT BY: prompt is answered, the user is asked for the range of values to sort by.   Sometimes it is convenient to have the values of these answers be computed at run time.   In such cases, if the answers are preceded with "@" signs, they may be understood as computed expressions.

For example, if we wanted the range of a certain date-valued field to be calculated as the week up to the day the output is run, we could enter:
Select OPTION:  PRINT FILE ENTRIES
Output from what File: PTF      
Sort by: NUMBER// DISCHARGE DATE
Start with DISCHARGE DATE: FIRST// @TODAY-6
DO YOU MEAN 'TODAY-6' AS A VARIABLE? Yes//   (Yes)
Go to DISCHARGE DATE: LAST// @TODAY
DO YOU MEAN 'TODAY' AS A VARIABLE? Yes//   (Yes)
  Within DISCHARGE DATE, Sort by:
....

Field Value Stuffing

In the Enter or Edit File Entries option, you can follow the // or /// specifiers with computed expressions. The expression is evaluated for the entry you are inputting and used as a variable stuff value.

Suppose you want to put the current contents of a patient's NEXT OF KIN field into the BENEFICIARY field, with a notation that this value is UNVERIFIED, for all patients who don't have a value in the BENEFICIARY field. The dialogue would look like this:


Select OPTION: ENTER OR EDIT FILE ENTRIES
INPUT TO WHAT FILE: PATIENT
EDIT WHICH FIELD: BENEFICIARY///NEXT OF KIN_" (UNVERIFIED)"
THEN EDIT FIELD: Select PATIENT NAME: ^LOOP
EDIT ENTRIES BY: BENEFICIARY=""
WITHIN BENEFICIARY="", EDIT ENTRIES BY:

This example uses two "on the fly" expressions: one in answer to the "EDIT ENTRIES BY:" prompt (which is essentially a SORT BY for looping) and one as the forced default value for the BENEFICIARY input field.

BENEFICIARY="" is a Boolean (True/False) computed expression that means "The BENEFICIARY value equals null."

After the previous dialogue, the names of such patients would be printed out, and their BENEFICIARY value would automatically be set equal to their NEXT OF KIN field value, concatenated with a space followed by "(UNVERIFIED)."


OUTPUT Transforms

OUTPUT transforms change the way a field is displayed when printed. Frequently, the OUTPUT transform will contain a computed expression that alters the data stored internally in the field. A simple OUTPUT transform that converts the internally stored date into MM/DD/YY format is:

 DATE OF BIRTH OUTPUT TRANSFORM: NUMDATE(DATE OF BIRTH)

If an OUTPUT transform is applied to a field, the result of the transform will be used if that field is used in another computed expression. For example, if DATE OF BIRTH is used in a PRINT template, the "transformed" value will be output:

 THEN PRINT FIELD: NAME_"'S BIRTHDAY: "_DATE OF BIRTH

The result of this computed expression would be similar to:

 JOHN DOE'S BIRTHDAY: 03/07/42

Word-processing Windows (| |)

When entering text into a field with a WORD-PROCESSING Data Type, you can insert a computed expression within a |Window|. This expression will be evaluated at the time the WORD-PROCESSING-type field is printed. If the expression is meaningful, its value will replace the |Window| in the printed output.

For example, you could embed within the text of the HISTORY WORD-PROCESSING-type field a |Window| containing a COMPUTED field expression:

 HISTORY: 
1> PATIENT IS A |SEX_" "_RELIGION| WHO HAS NO
2> APPARENT PROBLEMS.

When this field is printed for a patient who has a SEX value of MALE and a RELIGION value of CATHOLIC, the output would look like:

 PATIENT IS A MALE CATHOLIC WHO HAS NO 
APPARENT PROBLEMS.

 


Reviewed/Updated: October 2016