Movie Summary

RAMP-NL

Movie Summary


For movie Subfile Direct Access - 2 minutes.

This tutorial describes the subfile direct access foundation script.

Create the script Using the Scripting Pop-up Menu. The script reads all subfile pages, and for each page it reads all columns and for each column it reads all the cells.

By modifying this script you should be able to perform any required subfile operation.

Foundation Script

{

var strDataGridName = "xxxxxxxxx"; /* Specify the data grid name here */

var flagAnotherPageExists = true; /* Another subfile page exists */

/* Loop through all subfile pages */

do

{

var intColumnCount = TONUMBER(GETVALUE(strDataGridName + ".Columns.Count"));

var intRowCount = TONUMBER(GETVALUE(strDataGridName + ".RowCount"));

var intColumn, intRow = 0;

/* Iterate over the current subfile page */

for (intColumn = 0; intColumn < intColumnCount; intColumn++) /* Iterate through the columns */

{

var strColumn = intColumn.toString();

var strColumnName = GETVALUE(strDataGridName + ".Columns(" + strColumn + ").Name");

TRACE("Column number " + strColumn + " is named \"" + strColumnName + "\"");

/* Iterate through the cells in the column */

for (intRow = 0; intRow < intRowCount; intRow++) /* Iterate through the rows for a column */

{

var strRow = intRow.toString();

var strRowCellValue = GETVALUE(strDataGridName + ".Columns(" + strColumn + ").Cells(" + strRow + ").Text");

TRACE(" in row " + strRow + " it contains the value \"" + strRowCellValue + "\"");

} /* end iterating the rows for a column */

} /* end iterating the columns */

/* Proceed (or not) to the next subfile page based on the marker */

flagAnotherPageExists = (GETVALUE(strDataGridName + ".Marker") != "");

if (flagAnotherPageExists) { TRACE("Scrolling to next page."); SENDKEY(KeyPageDown); }

else { TRACE("End of subfile encountered"); }

} while(flagAnotherPageExists); /* Loop around and process the next subfile page */

} /* NOTE: This script is dependent on the use of newlook for 5250 access */

 

To test you have the row you want

To work with subfile entries you need to compare your search value with the text in the cell. To read the text in a cell:

strCell = StrGridName+".Columns("+strColumn+").Cells("+strRow+").Text;

 

And put the value into a GETVALUE function:

StrRowCellValue = GETVALUE( strCell );

 

To set the value of a cell:

SETVALUE( strCell, "some valid value" );