This document describes target paths, the currently supported segments they're composed of, and how they can be used.
Target paths are strings which are interpreted at runtime. A target path is composed of segments which are resolved one after the other, with the result of one being used for the evaluation of the next. The result of the last segment is also the result of the target path. Each of these results (or "contexts") has two pieces of information: a data binding and, if appropriate, an associated UI element. Target paths are often used in metadata to retrieve a data binding that already exists somewhere in the app, but may also be used in rules to access data bindings or UI elements.
A target path is built up using segments. Segments are separated by a slash (
/) and generally have the following form:
SegmentName specifies which segment should be used and
ParameterValue is a custom value that's passed to it. Parameters are only used by some segments.
As mentioned above, segments take a context as their input, and pass the resulting context to the next segment. The starting context for a target path will often be either the current page or the current control, depending on where the target path is used.
If inside a segment the name or any other value of an object contains a slash (
/), it must be escaped with two slashes (
#First- Returns the first item. Only valid if the current context is a list control or an array.
#Last- Returns the last item. Only valid if the current context is a list control or an array.
#Application- Returns the context of current application.
DeviceIdare stored in its
#Page:PageName- Returns the page with name
#Page:-Previous- Returns the page that comes before the current page on the stack. These can be chained with other
#Control:ControlName- Returns the control with name
ControlName. Only valid if the current context is a page.
#Value- Returns the value of a control. Only valid if the current context is a control.
#SelectedRow- Returns the index of the current selection. Only valid if the current context is a list control.
#SelectedTarget- Returns the data for the current selection. Only valid if the current context is a list control.
#Count- Returns the count. Only valid if the current context is a list control or an array.
#ClientData- Returns the
ClientDataobject associated with the current context. This may be modified in a rule to provide easy access to custom data. Only valid if the current context has a UI element, for example, a control or a page. See also the
getClientDatamethod of the
#ActionResult:ActionResultName- Returns the
ActionResultobject associated with the name.
#Index:IndexNumber- Returns the item specified by
IndexNumber. Only valid if the current context is a list control or an array. This is optional, by default, only defining the index number is sufficient.
#Property:PropertyName- Returns the property with name
PropertyName. Only valid if the current context is an object. This is optional, by default, only defining the property name is sufficient.
If your application is targeting mobile development kit 4.2 or older, using segment
#Index:IndexNumber is mandatory for array index and
#Property:PropertyName is mandatory for property name.
Targeting a Page¶
This target path returns the page with name "WorkOrderDetails".
#Page:WorkOrderDetails-> Returns a page with a specific name.
Targeting a Control¶
To get a control from the "WorkOrderDetails" page:
To get the same control when the target path's context is the "WorkOrderDetails" page:
To get the same control when the context is a page that was navigated to from the "WorkOrderDetails" page:
Targeting the Value of a Control¶
To get the value of a control on a specified page:
Targeting Items in a List¶
The following target paths can be evaluated from a page which has a list picker control with name "ListPicker".
#Control:ListPicker/#Value/#First-> Returns the first item in the control.
#Control:ListPicker/#Value/#Last-> Returns the last item in the control.
#Control:ListPicker/#Value/5-> Returns the 5th item in the control.
#Control:ListPicker/#Value/5/DisplayValue-> Returns the
DisplayValueproperty from the 5th item in the control.
#Control:ListPicker/#SelectedTarget-> Returns the data associated with the currently selected list item.
#Control:ListPicker/#SelectedRow-> Returns the currently selected rows index.
#Control:ListPicker/#SelectedValue-> Returns the selected value (
ReturnValue) associated with the currently selected item from the
Targeting Properties on Application's
#Application/#ClientData/UserId-> Returns the
UserIdof current user.
#Application/#ClientData/DeviceId-> Returns the
DeviceIdof current device.
#Application/#ClientData/MobileServiceEndpoint-> Returns the Endpoint URL of application in mobile services on SAP Business Technology Platform.
#Application/#ClientData/MobileServiceAppId-> Returns the App ID of application in mobile services on SAP Business Technology Platform.
Targeting Properties on a Page's
The following target path can be evaluated from a page whose
ClientData object has an
items property which is an array.
#ClientData/items/#First-> Returns a the first item in the
Targeting the Result Property in an
The following target path can be evaluated while in an action chain having a previous action save off an
ActionResult named 'CreateWorkOrder'.
#ActionResults:CreateWorkOrder/data/OrderDescription",-> Returns the result's