Script for Locating an Entry when no Positioning is Available and the List has more than One Page

RAMP-NL

Script for Locating an Entry when no Positioning is Available and the List has more than One Page


The previous example showed how to handle a list with only one page. If a list has more than one page, we have to page down until the end of the list.

Therefore, the for loop should be enclosed within another loop to be executed while we haven't reached the end of the list. Note that in this case, the row count must be retrieved for each page.

var flagPageDown = true;

while (flagPageDown)

{

 intRowCount = GETVALUE("uDataGrid.RowCount");

 for (var intRowNo = 0; intRowNo < intRowCount; intRowNo++)

 {

   /* Get the number of cells in this row. */

   intColCount = GETVALUE("uDataGrid.ColCount");

   for (var intColNo = 0; intColNo < intColCount; intColNo++)

   {

      if ( GETVALUE("uDataGrid.Rows(" + intRowNo + ").Cells(" + intColNo + ").Text") == strCompare)

      {

         /* Type a 2 next to the first entry and press enter */

         SETVALUE("uDataGrid.Rows(" + intRowNo + ").Cells(0).Text", 2);

         SENDKEY(KeyEnter);

  /* Reset the flag to cause the while loop to end */

         flagPageDown = false;

         break;

      }

   }

 }

   if (flagPageDown)

   {

       /* Get the value of the newlook indicator that tells us whether there is another page in the list. If not, reset the flag to cause the while loop to end */

      if (GETVALUE("uDataGrid.Marker") != "") SENDKEY(KeyPageDown);

      else flagPageDown = false;

   }

}