Easier way to get the value of the key in Keyed collection?
Posted: Tue Jul 26, 2022 12:32 pm
Hi all,
product: Visual LANSA(Form)
version: V15(EPC150040)
Our customer says that they want to get Key value of Keyed collection in Evtroutine.
Their coding is as below:
- define keyd collection of #PRIM_EVEF
- in Evtroutine, get Key value of collection
- they know that it works as expected, but they want to know simpler and easier coding (if it exists).
Does anyone have any idea?
Any advise is appreciated.
Thanks in advance.
Best regards, Yukiko Ikeo
product: Visual LANSA(Form)
version: V15(EPC150040)
Our customer says that they want to get Key value of Keyed collection in Evtroutine.
Their coding is as below:
Code: Select all
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(484) Clientheight(302) Componentversion(2) Left(441) Top(200)
Define_Com Class(#PRIM_KCOL<#PRIM_EVEF #STD_STRNG>) Name(#Fields) Style(Collection)
Define_Com Class(#DEPTMENT.Visual) Name(#DEPTMENT) Displayposition(1) Left(45) Parent(#COM_OWNER) Tabposition(1) Top(46)
Define_Com Class(#SECTION.Visual) Name(#SECTION) Displayposition(2) Left(45) Parent(#COM_OWNER) Tabposition(2) Top(99)
Define_Com Class(#EMPNO.Visual) Name(#EMPNO) Componentversion(1) Displayposition(3) Height(21) Left(45) Parent(#COM_OWNER) Tabposition(3) Top(149) Usepicklist(False) Width(245)
Evtroutine Handling(#com_owner.CreateInstance)
Set Com(#com_owner) Caption(*component_desc)
* Fields
#Fields<DEPT> <= #DEPTMENT
#Fields<SECT> <= #SECTION
#Fields<EMP> <= #EMPNO
Endroutine
Evtroutine Handling(#Fields<>.Changed) Com_Sender(#Sender)
For Each(#Current) In(#Fields) Key(#Key)
If ((#Current.Name = #Sender.Name))
#STD_STRNG := #Key
Leave
Endif
Endfor
Use Builtin(MESSAGE_BOX_ADD) With_Args(#STD_STRNG)
Use Builtin(MESSAGE_BOX_SHOW)
Endroutine
End_Com
- in Evtroutine, get Key value of collection
- they know that it works as expected, but they want to know simpler and easier coding (if it exists).
Does anyone have any idea?
Any advise is appreciated.
Thanks in advance.
Best regards, Yukiko Ikeo