A multi-row field map is able to define a screen that has tabular data. For example, the "AcctTrans" screen below has a list of data. It is possible to map a screen such as this by defining a map for the top row. The succeeding rows can then be accessed by indexing the defined field. The example below will demonstrate how to do this.
Run the mapper and open the "Insure.xml" definition file that was installed with the package.
Click on the AcctTrans screen. It has two screen maps defined. The "default" map is used to store field location information about the "More indicator". If there is more data on following screens then the text "MORE..." will appear at this location. When the indicator no longer has the value "MORE..." then there is no need to move to the next screen to retrieve more data.
Click the "Import" button and select the "Insure.rec" recording. Scroll down to and select the "Account Transaction List" screen (note that it has the text "MORE..." in the lower right corner).
With the "AcctTrans" screen imported into the mapper, the definition becomes clear when the "rowData" screen map is selected. The first row for each column of data is highlighted and given a name.
The following sample code navigates to the "Account Transaction List" screen and retrieves records from the screen.
This script has 6 functions/routines:
•connect
•disconnect
•navigateToAcctTrans
•navigateToPolicySelect
•specialWait
•showMultiRowData
The connect and disconnect are self-explanatory.
The navigateToAcctTrans function handles the navigation to the AcctTrans screen. Refer to transition handling for more information on handling navigation and transitions. navigateToPolicySelect navigates back to the host application's "root" menu. The specialWait function waits for the currently active to change. It returns an error if the screen does not change.
The showMultiRowData function gets the data from the host screen using the screen map. The screen definition for AcctTrans has two screen map definitions:
1. | default |
2. | rowData |
As rowData contains the map definition for the list of data it is necessary to make it the active map. This is done by setting the activeMapName property of the HostScreen object.
The screen map definition only needs to define the first row of data on a screen. In order to retrieve any of the following rows of data a zero-based index is used. As can be seen in the example, the FOR loop begins at index 0 through to 13, thus returning the following 14 rows of data:
DATE |
ACTION |
AMOUNT |
999999 |
SETUP TRIGGER |
0.00 |
999999 |
BILL DAY CHNG-30 |
0.00 |
111103 |
PEND PREM APPLY |
822.34 |
301003 |
SYS GEN ADJUSTMT |
2003.00 |
301003 |
PEND PREM APPLY |
1180.66 |
301003 |
FINAL AUDIT |
2003.00 |
301003 |
RENEWAL PREMIUM |
3383.00 |
091003 |
RENEWAL PREMIUM |
4857.00 |
150703 |
CASH (0)-APL |
8.00 |
150703 |
CASH (0)-APL |
823.50 |
150703 |
CASH (0)-APL |
1007.25 |
150703 |
CASH (0)-RCV |
1838.75 |
010703 |
INSTALL NOTICE |
1838.75 |
010703 |
SERVICE CHARGE |
8.00 |
Tip - If data takes up 2 rows then increment the index variable by 2 for each loop (refer to the mappedRowGet method for information).