Case A: When a selection is found, set the cursor on the appropriate row and press Enter.

     uSubfileSearch: function(sToForm, sFindValue, sFindField, sMoreRecsField)
{
 
/* Subfile indexed fields are one based */
 
    var iInd = 1;
    var bFound = false;
 
     while( (CHECK_FIELD_EXISTS(sFindField,iInd)) && !(bFound) )
        {
          /* Found, set the flag to true to cause the loop to end */
          if (sFindValue == GETVALUE(sFindField,iInd))
          {
            bFound = true;
          }
          else /* Increase field index */
          {
            iInd++;
          }
        }
 
        /* If found, position the cursor to the field and index and send an Enter key to cause that entry to be selected */
        if (bFound)
        {
            SETCURSORTOFIELD(sFindField,iInd);
            SENDKEY(KeyEnter);
            Q_CHECK_CURRENT_FORM(sToForm,"Unable to navigate to " + sToForm);
        }
        /* If not found, check whether the nominated more records indicator field is present on the screen. If it is we can page down. */
        /* Note the payload accompanying the Sendkey. It is used in the vHandleArrive function to decide whether we have to repeat this logic. */
       
        else if ( CHECK_FIELD_EXISTS(sMoreRecsField) )
        {
            SENDKEY(KeyPageDown, "Next_Page");
        }
        }

Case B: When a selection is found, set the cursor on the appropriate row, set the value of the selector field "SFL_SELECT" to "2" and press Enter.

This case is almost the same as the prior one except for the SETCURSOR call. Replace the SETCURSOR with

     SETVALUE("SFL_SELECT", "2", iInd);
  • No labels