サブファイルの特定の値を見つけて選択する
ケースA:選択肢が見つかったときに、該当する行にカーソルを設定して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");
}
}
ケースB:選択肢が見つかったときに、該当する行にカーソルを設定し、セレクター・フィールド"SFL_SELECT"の値を"2"に設定し、Enterを押す。
このケースは、SETCURSORの呼び出しを除き、前のケースとほとんど同じです。SETCURSORを以下の記述に置き換えます。
SETVALUE("SFL_SELECT", "2", iInd);