Updating and Deleting Instance List Entries in VLF-WIN

A special parameter Mode(DYNAMIC) can be used on the BeginListUpdate method.  

Instance list activities typically fall into two broad modes of processing:

Mode(REFRESH) is the default style of list processing.

There's some differences between how Mode(REFRESH) and Mode(DYNAMIC) requests are handled by the Framework:

Finally, there's two ways to update an instance list entry:  You can use #ListManager.AddtoList or #ListManager.UpdateListEntryData. Both will cause an existing entry to be updated, but only AddtoList will create a new entry when the specified one does not exist. 

The main difference between them is:

Warning:

When a Relationship handler is used to dynamically expand he nodes in an instance list displayed as a tree you can use the #avListManager.RefreshRelationship method to programmatically cause a level in the tree to be completely refreshed.

For example, the shipped demonstration filter DF_FILT08 contains this logic listening for the event DEM_EMP_UPDATED ….

* If an employee update has been triggered

When (= DEM_EMP_UPDATED)

* Get the department and section this employee belonged to at the time they were added to the instance list

Invoke #avListManager.GetCurrentInstance AKey1(#Original_Deptment) AKey2(#Original_Section) AKey3(#Empno)  

* Refresh the tree node that the employee was in originally (this might cause the employee to be removed from the node).

* This method causes the relationship handler function DFREL01 to be called again to refresh the whole tree node.

Invoke #avListmanager.RefreshRelationship BusinessObjectType(DEM_ORG_SEC_EMP) AKey1(#Original_Deptment) Akey2(#Original_Section)

* Now see what department and section the employee is in now. If either has changed, update the tree node for the

* the new department/section. If this node has never been expanded this request will be ignored, because the employee

* will be shown later if / when the user decides to expand this node.

Fetch Fields(#Deptment #Section) from_file(PslMst) with_key(#Empno)

If ((#Deptment *ne #Original_Deptment) or (#Section *ne #Original_Section))

Invoke #avListmanager.RefreshRelationship BusinessObjectType(DEM_ORG_SEC_EMP) AKey1(#Deptment) Akey2(#Section)

Endif