Step 2 Create a Hidden Filter for _Departments

VLF Windows Application Development

Step 2. Create a Hidden Filter for _Departments.

VFW100 – Define a Parent/Child Instance List

The instance list will be initially loaded with all departments from the Department table (DEPTAB).

1.  Create a new Reusable Part / Object:

     Name: iiiVFW24

     Description: Departments Hidden Filter

2.  Give the reusable part an ancestor of VF_AC007.

3.  Create an uInitialize method routine after the BEGIN_COM statement:

Mthroutine Name(uInitialize) Options(*Redefine)

Endroutine

 

4.  In the uInitialize routine make the filter hidden, so that all that will show at run-time is the instance list:

Set #Com_Owner avHiddenFilter(TRUE)

5.  Then indicate that the instance list updating is about to start and clear the instance list:

#avListManager.BeginListUpdate

#avListManager.ClearList

 

6.  Read all the departments and add them to the instance list:

Select Fields(#Deptment #DeptDesc) From_File(DEPTAB)

#avListManager.AddtoList Visualid1(#DeptDesc) Visualid2(#Deptment) Akey1(#Deptment) Businessobjecttype('_DEPARTMENTS') Ncolumn1(0) Acolumn1('') Acolumn2('') Acolumn3('') Acolumn4('') Acolumn5('') Acolumn6('') Acolumn7('')

EndSelect

 

Note:

  • It is necessary to initialize the additional columns with the AddToList is invoked, as you will later populate the list with entries for _Sections, which will fill these columns.
  • The BusinessObjectType() parameter must use your business object User Object Name/Type and is uppercase.

7.  Lastly indicate that instance list updating is now complete:

#avListManager.EndListUpdate

     Your code should look like this:

 

8.  Compile the filter.

9.  Display the Framework and open the Properties dialog for the _Departments business object.

10. Display the Filter / Snap-in Settings tab.

11. Specify iiiVFW24 as the real filter.

12. Close the _Departments' properties dialog. Save and Restart your Framework.

13. Select _Departments so that the hidden filter loads the departments into the instance list.

14. Expand a Department. Notice that no _Sections are loaded. You will create the relationship handler that loads the sections in the next step.