Displaying all fields in a record

From m204wiki
Revision as of 03:38, 4 April 2023 by Ekern (talk | contribs)
Jump to navigation Jump to search

The SOUL PAI (Print All Information) statement displays the values of the visible fields in a record. You can get this same display within the Debugger by using the pai command (or from the menu: Data Display > PAI).

The pai command is a Client command you specify in a macro or map to a button or hot key. If you use pai at an execution point where there is a current record (for example, in a FOR EACH RECORD loop), a display of the record's fields that is the same as the SOUL PAI statement is shown.

A typical scenario for using the pai command might include these steps:

1. You map the command to a key. In the ui.xml file, you specify the following to set CTRL-A to issue a pai command:

<mapping command="pai" key="a" keyModifier="ctrl"/> 

2. While debugging a request, you press CTRL-A when you are in a record context.
In a Value window, you see a PAI format display of the current record.
A Value window display is the default. As shown below, the output may also be displayed in the macro console window.

Alternatively, you can use the pai command in a Debugger macro or from the command line. For example, say your macro is a pai.macro text file that has the single statement:

pai 

You run the macro at a debugging execution point where there is a current record, and although it is not required, you have the macro console open. The record's PAI output displays on the console.

Displaying a record's field groups

If you are debugging a request against a file with field groups, the pai command display also includes the field group occurrences, each beginning with a backward slash (\) and ending with a forward slash (/).

To display the fields in the current field group, use the pafgi command (or Display > PAFGI from the menu), which produces the same output as the SOUL PAFGI (Print All Fieldgroup Information) statement. The discussion above about ways to map and use the pai command applies entirely to the pafgi command as well.

Invoking the pafgi command while in field group context produces a display of the fields in the current field group. For example, for the STOOGES field group in the same request and record as in the preceding example, this is the pafgi display.

Field group $functions

The Debugger recognizes and evaluates User Language $FieldGroupID and $FieldGroupOccurrence function calls. These functions are useful for operating selectively on field group instances.

$FieldGroupID returns the unique numeric identifier that Model 204 assigns to each field group in a record. $FieldGroupOccurrence returns the current occurrence number of an occurrence of a repeating field group.

To view the value of either $function, you can right click its program line in the Source Code page and select Add Watch from the context menu.

The $function is added to the Watch Window and its current value is displayed whenever the current program context is a field group. The function value subsequently displays when the program execution point is in any field group.

To view the $function value without adding it to the Watch Window, you can right click a program line that explicitly contains it and select the Display option. The value is shown in a separate Value window.