Salesforce

How Do I Properly Define a Hierarchical Data Source that Will Fit a Tree Control Display? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Properly Define a Hierarchical Data Source that Will Fit a Tree Control Display? (Magic xpa 4.x)

To get a tree to display, you need to have the data structured correctly. In order to do this, you may need to create a memory table to temporarily hold the data.

The key to the structure are two fields: the Parent ID and the Node ID. The Node ID is what identifies this particular record, and it will probably be the unique identifier of a record. The Parent ID identifies the parent of this record.

Recursion

You must be sure that the Parent ID and Node ID of each record are different. Otherwise you will get a recursive tree, where one branch can open an infinite number of times. In other words, the node “S002” cannot also have a Parent Node of “S002”. This is usually only a problem with the Root node, because there is a tendency to leave both the Parent Node and Node fields blank.

Hint: It is likely that a tree might contain data from several different tables. In our example, we used data from the “studio” table and from the “DVD” table. Since each of these tables has very different data, we just collected the minimum information to display onscreen. If we wanted to display more information, we would link to the original record rather than trying to move it into this temporary table.

See also

The Online and Rich Client Samples projects (program TR02 and RTR02)

Reference
Attachment 
Attachment