Form S_162FPL: Positioning to a Value in a List

LANSA

Form S_162FPL: Positioning to a Value in a List
Name: S_162FPL

Description: The following RDMLX form demonstrates a technique for positioning to and selecting the first generically identical entry in a list view.

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Height(324) Layoutmanager(#ATLM_1) Left(369) Top(185) Visualstyle(#VS_NORM) Width(234)
Define_Com Class(#PRIM_LTVW) Name(#EMP_LIST) Displayposition(1) Height(278) Left(0) Parent(#COM_OWNER) Selectionstyle(Single) Tabposition(2) Top(19) Width(226)
Define_Com Class(#PRIM_LVCL) Name(#LVCL_1) Displayposition(1) Parent(#EMP_LIST) Source(#SURNAME) Width(20) Widthtype(Remainder)
Define_Com Class(#SURNAME.Visual) Name(#POSITION_TO_SURNAME) Displayposition(2) Height(19) Marginleft(0) Parent(#COM_OWNER) Tabposition(1) Width(226)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Top) Manage(#POSITION_TO_SURNAME) Parent(#ATLM_1)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_2) Attachment(Center) Manage(#EMP_LIST) Parent(#ATLM_1)

* Fill the list view with employees in surname order

Evtroutine Handling(#com_owner.Initialize)
Select Fields(#SURNAME) From_File(PSLMST2)
Add_Entry To_List(#EMP_LIST)
Endselect
Endroutine

* Handles changes to the position surname by selecting
* the first name >= the position to surname

Evtroutine Handling(#POSITION_to_SURNAME.Changed)
Define Field(#POS_ENTRY) Reffld(#STD_NUM)

If Cond('#Emp_List.Entries > 0')

* Initialize search values

Change Field(#POS_ENTRY) To(1)

* Look for the first name >= the position name

Selectlist Named(#EMP_LIST)
Change Field(#POS_ENTRY) To('#Emp_List.CurrentItem.Entry')
Leave If('#SurName >= #Position_to_Surname.Value')
Endselect

* Select the matching entry and make it selected and visible

Get_Entry Number(#POS_ENTRY) From_List(#EMP_LIST)
Set Com(#Emp_List.CurrentItem) Selected(True) Ensurevisible(True)

Endif

Endroutine

End_Com