One of the most common uses of computed fields on a report is to print the user's run time selections on a report.
For fields where you use the EQ, NE, or IG selection operator, the value entered by the user is stored in c.field.name, for example:
To print the value entered by the user, create a computed field as follows:
For extra credit, you might want to print "ALL" if the user accepted the default keyword:
Since the Report Screen stores an ASCII 127 in the b. c. or e. fields when the keyword ALL, BEGINNING, or END is used, you can test for the D(127) value and print the appropriate text with an IF statement in your computed field.
If the selection operator GE or GT is used:
If the selection operator LE or LT is used:
PS: The field "inpatient.location" provides a lookup on just the inpatient locations, and is more convenient than a selection on the location field for reports confined to inpatients.
What happens to a list (LI) of locations?
A list is stored like this:
If you want to print the locations from the list, you need to loop thru the values stored as subscripts of c.inpatient.location and either concatenate them into a long line or list them with an MV array. If you use an MV array in a page header, be careful to make sure that the number of entries will never exceed the size of the page, otherwise you will loop until your printer is out of paper.
The most compact way to list them would be in a line in the page header: