Step 2. Create Form iiiFRM05 - Get Employees using JSON Client

INT010B - JSON Service - Create Agent-side Business Logic

This is a very simple form into which the user enters a department and section code and clicks a button labelled Get Employees.

The program then displays a list of employees for that department and section. The visual design of the form is as follows:

1.  In the LANSA Editor, from the File menu, create New / Basic Form,  iiiFRM05 – Get Employees using JSON. Create the form as RDMLX enabled.

     Copy and paste the following code into the form:

     Change the CALL statement to call your function iiiFN11.

Function Options(*DIRECT)

Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(798) Clientheight(425) Componentversion(2) Left(620) Top(190)

Define_Com Class(#DEPTMENT.Visual) Name(#DEPTMENT) Displayposition(1) Left(17) Parent(#COM_OWNER) Tabposition(1) Top(16)

Define_Com Class(#SECTION.Visual) Name(#SECTION) Displayposition(2) Left(14) Parent(#COM_OWNER) Tabposition(2) Top(49)

Define_Com Class(#PRIM_PHBN) Name(#Button1) Displayposition(3) Left(272) Parent(#COM_OWNER) Tabposition(3) Top(24) Caption('Search')

Define_Com Class(#PRIM_LTVW) Name(#ListView1) Columnbuttonheight(27) Componentversion(2) Displayposition(4) Fullrowselect(True) Keyboardpositioning(SortColumn) Left(23) Parent(#COM_OWNER) Showsortarrow(True) Tabposition(4) Top(94) Height(307) Width(730)

Define_Com Class(#PRIM_LVCL) Name(#LVCL1) Displayposition(1) Parent(#ListView1) Source(#EMPNO)

Define_Com Class(#PRIM_LVCL) Name(#LVCL2) Displayposition(2) Parent(#ListView1) Source(#SURNAME) Width(28)

Define_Com Class(#PRIM_LVCL) Name(#LVCL3) Displayposition(3) Parent(#ListView1) Source(#GIVENAME) Width(25)

Define_Com Class(#PRIM_LVCL) Name(#LVCL4) Displayposition(4) Parent(#ListView1) Source(#SALARY) Widthtype(Remainder)

 

Def_List Name(#EMPS) Fields(#EMPNO #GIVENAME #SURNAME #SALARY) Type(*WORKING) Entrys(*MAX)

 

Evtroutine Handling(#com_owner.CreateInstance)

 

Set Com(#com_owner) Caption(*component_desc)

 

Endroutine

 

Evtroutine Handling(#Button1.Click)

Exchange Fields(#DEPTMENT #SECTION)

Call Process(*DIRECT) Function(iiiFN11) Exit_Used(*NEXT) Pass_Lst(#EMPS)

 

Clr_List Named(#ListView1)

Selectlist Named(#EMPS)

Add_Entry To_List(#ListView1)

Endselect

Endroutine

End_Com 

 

2.  Compile your form.