Create a Reusable Part For the Filter

In the Visual LANSA editor, use File > New > Reusable Part:

 

Choose Basic Filter in VLF-ONE Reusable Part:

 

Give the filter a name and description, and make the Target Platform Web Browser.

 

Click Create.

When the filter has been opened in the editor, double-click it to display its details. Note that its ancestor is #VF_AC007O which is the common ancestor for all VLF-ONE fiters:

 

Switch to the Source tab and replace the code in it with this code:

Function Options(*DIRECT)

Begin_Com Role(*EXTENDS #VF_AC007O) Layoutmanager(*NULL) Width(249) Height(161)

 

 

Define_Com Class(#xEmployeeSurname.Visual) Name(#SearchSurname) Displayposition(1) Height(25) Parent(#COM_OWNER) Tabposition(1) Width(209) Labeltype(Caption) Marginleft(0) Top(48) Left(8)

Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('Specify full or partial surname:') Displayposition(2) Ellipses(Word) Height(25) Left(12) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(27) Verticalalignment(Center) Width(197)

 

 

* Used to save and restore search values

Def_List Name(#Save_Keys) Fields(#xEmployeeSurname #xEmployeeGivenNames) Type(*Working) Entrys(1)

 

* The list used to receive data from the server module

Def_List Name(#xEmployeeList) Fields(#xEmployeeIdentification #xEmployeeSurname #xEmployeeGivenNames #xEmployeeStreet #xEmployeeCity #xEmployeeState #xEmployeePostalCode #xEmployeeHomeTelephone #xEmployeeBusinessTelephone #xEmployeeStartDate #xEmployeeTerminationDate #xDepartmentCode #xEmployeeSalary) Counter(#ListCount) Type(*Working) Entrys(*Max)

 

* --------------------------------------------------------------------------

Mthroutine Name(uInitialize) Options(*REDEFINE)

* Do ancestor first

#COM_ANCESTOR.uInitialize

 

Endroutine

* --------------------------------------------------------------------------

 

Evtroutine Handling(#SearchSurname.Enter)

 

* Clear all messages

#AVFRAMEWORKMANAGER.avClearMessages Requester(#COM_OWNER)

 

* Only search if a search value has been entered

If (#SearchSurname.Trim <> "")

#COM_OWNER.SelectEmployeeData

* Otherwise issue a message

Else

#AVFRAMEWORKMANAGER.avIssueMessage Text("Enter some part of the surname") Requester(#COM_OWNER) Type(WARN)

Endif

 

Endroutine

Mthroutine Name(SelectEmployeeData)

 

* Define the Server Module method routine used to get employee data from the server

Define_Com Class(#SModule1.FindxEmployeeBySurna) Name(#Find)

 

* Save the current key values from overwrites done by the select loop

Inz_List Named(#Save_Keys)

 

* indicate to the user that we are busy

#COM_OWNER.avGotoBusyState Showbusytext('Searching') Animated(False)

 

* Ask Server Module SModule1 to get the data from the server

#Find.ExecuteAsync( #SearchSurname #xEmployeeGivenNames #xEmployeeList )

 

* The call is asynchronous so we have an event that occurs when the call is finished

Evtroutine Handling(#Find.Completed)

 

* Read the list returned by Server Module SModule1

Selectlist Named(#xEmployeeList)

 

#avListManager.AddtoList Visualid1(#xEmployeeIdentification) Visualid2(#xEmployeeSurname + ', ' + #xEmployeeGivenNames) Akey1(#xEmployeeIdentification)

 

Endselect

 

* Restore the saved key values

Get_Entry Number(1) From_List(#Save_Keys)

 

* Go back to display free state

#com_Owner.avGotoFreeState

 

Endroutine

Endroutine

* --------------------------------------------------------------------------

End_Com

 

Switch to the Design tab to see the filter user interface:

 

Compile the filter.