In VLF-ONE Adding Children is Simpler

 

In VLF-ONE every instance list entry must have unique key of course.

However the relation ship between a parent and child list item is formed very simply.

This an example:

* Define a reference to temporarily hold the employee data item

Define_Com Class(#VF_LM003O) Name(#ParentEmployeeItem) Reference(*DYNAMIC)

* Add the parent employee list entry and get back the #VF_LM003O item reference

#avListManager.AddtoList Akey1(#Empno) Visualid1(#Empno)

               Visualid2(#GiveName+ #SurName)

               Dataitem(#ParentEmployeeItem)

* Now add skill children items to that employee ...

Repeat for each skill that employee #Empno has

* Add the skill instance list entry as a child of the employee just added

#avListManager.AddtoList Akey1(#Empno) Akey2(#SKILCODE)

                         Visualid1(#Skilcode) Visualid2(#SkilDesc)

                         ParentDataItem(#ParentEmployeeItem)

Endfor

Note carefully: When dealing with #VF_LM003O item references never keep them or your application will leak. If the reference is globally scoped in your code always set it to*NULL when you have finished using it. 

For an example see shipped Examples -> Advanced -> Children:

Note that tree visualization in VLF-ONE is different to VLF-WIN.

If you want parents and children to be presented in another way, you can make a list of custom panels (like the shipped Person example) or build and snap in your own custom instance list browser.

To make parent-child relationships work:

1.

A business object has to be defined for the parent and each child

 

For example, in the shipped VLF-ONE Children example the parent is PARENT_PRODUCT and the children are CHILD_ORDER and CHILD_SUPPLIER.

 

2.

A relationship has to be defined between the parent and the children on the Instance Lists tab of the parent

 

For example, the shipped demo's PARENT_PRODUCT has these relationships defined:

3.

When adding items to the instance list you need to specify their user object names and parent items.

 

When adding items to the instance list you need to specify:

  • Their user object names in the Businessobjecttype() parameter of the AddToList method.
  • If an item is a child, their parent item in the ParentDataItem() parameter.