SetCursorPos in Peoplesoft
How to use function peoplecode of peoplesoft about setcursorpos in peoplesoft. You can use this function for fix position of cursor on page.
This Syntax : SetCursorPos(Page.pagename,scrollpath, target_row, [recordname.]fieldname)
where scrollpath is: [RECORD.level1_recname,level1_row, [RECORD.level2_recname,level2_row, ]] RECORD.target_recname
To prevent ambiguous references, you can use SCROLL.scrollname, where scrollname is the same as the scroll level’s primary record name.
Pagename: The name of the page specified in the page definition, preceded by the keyword Page. The page name page must be in the current component. You can also pass the %page system variable in this parameter (without the Page reserved word).
scrollpath: A construction that specifies a scroll level in the component buffer.
[recordname .]fieldname: Specify a field designating the record and field in the scroll where you want to place the cursor.
target_row: The row number of the row in which you want to place the cursor.
This is example code set cursor when control cursor in page activate
This picture has page name is TEST_PAGE include scroll area level 1 is record of TEST_TBL. My requirement check Flag.
If Flag = Y then Set cursor at TEST_TBL.DESCR254_1.
If Flag = N then Set cursor at TEST_TBL.DESCR254_2.
Example 1 : SetCursorPos(Page.Page_name, Record.Field, &i);
You place peoplecode at page activate by condition if flag = Y then set cursor at Descr254_1.
This code is “SetCursorPos(Page.test_page, Record.TEST_TBL.Descr254_1, &i);”
Result
Example 2 :
SetCursorPos(Page.Page_name, Record.Field, &i);
You place peoplecode at page activate by condition if flag = N then set cursor at Descr254_2.
This code is “SetCursorPos(Page.test_page, Record.TEST_TBL.Descr254_2, &i);”
Result
Ref: https://docs.oracle.com/cd/E15645_01/pt850pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm%23g037ee99c9453fb39_ef90c_10c791ddc07__3c78