In this step you will add a new treeexpand WebRoutine to handle expanding departments to add the department's sections and expanding sections to add employees for the selected section.
#std_num := (#deptment.CurChars + 1)
. . . . . .
#section := #listid.substring( #std_num )
Webroutine Name(treeexpand) Response(*json)
Web_Map For(*input) Fields((#ancestor *json))
Web_Map For(*output) Fields((#emptree *json))
Web_Map For(*input) Fields(#onsubid #onsublvl)
Clr_List Named(#emptree)
Case (#onsublvl)
* Level 1 expanding – add sections
When (= '1')
#deptment := #onsubid
Select Fields(#deptment #section #secdesc) From_File(sectab) With_Key(#deptment)
#listid := #deptment + #section
#listcapt := #secdesc
#listpid := #deptment
#haschld := Y
#selwam := iiiTRE_2
#selwrn := SECDET
Add_Entry To_List(#emptree)
Endselect
* Level 2 expanding – add employees
When (= '2')
Get_Entry Number(1) From_List(#ancestor)
#deptment := #listid
#std_num := (#deptment.CurChars + 1)
Get_Entry Number(2) From_List(#ancestor)
#section := #listid.substring( #std_num )
Clr_List Named(#emptree)
Select Fields(#empno #surname #givename) From_File(pslmst1) With_Key(#deptment #section)
#listid := #empno
#listcapt := #surname + ', ' + #givename
#listpid := #deptment + #section
#haschld := N
#selwam := iiiTRE_2
#selwrn := EMPDET
Add_Entry To_List(#emptree)
Endselect
Endcase
Endroutine
Property | Value |
|---|---|
onexpand_wrname |
|
onsubmit_id_field |
|
onsubmit_level_field |
|
onsubmit_ancestor_list |
|
