Show TOC Start of Content Area

Background documentation Lead Selection  Locate the document in its SAP Library structure

The lead selection is important within the nested context structure. At runtime, any node having cardinality 0..n or 1..n will probably have more than one element in its collection. The lead selection defines which element of the context is ultimately accessed at runtime. This behavior is easiest to explain using an example.

Example

The UI of the example car rental application in section Singleton Node contains a TextView element that should display the name of the customer at runtime. Without a clear regulation of the selection path for the context structure, all values of the Name attribute would be equal and it would not be possible to correctly display the name in the TextView element. For this reason, one element of the set of possible elements for the Customer node must be clearly designated. This is achieved by initializing lead selection. The automatic initialization of the lead selection always designates the first element of a node. For the above example, this means:

The lead selection is always automatically on the first element of the Vehicle node (on the node with the data for the red car). Analog to this, the lead selection is on the first element of the Customer subnode (on the element that contains the data for David Grecco).

This graphic is explained in the accompanying text

Only if the lead selection moves to another element of the Vehicle node (as a result of user action or a program step in a method) is the corresponding element of this Customer subnode displayed in the UI element. If the lead selection is set on the second element of the Vehicle node, the customer Pierre Dubois is displayed. The lead selection of the Customer node can be varied at runtime in this way. This enables the names of all available customers to be displayed one after the other in the UI.

End of Content Area