Skip to content

Object Binding

Info

This topic should only be used for application targeting Mobile Development Kit 4.2 or older.

From Mobile Development Kit 4.3 release or newer, the application now supports unified binding syntax. For more information, see Binding.

Object bindings are strings enclosed in '{}' that contains a path to a property name of the current context's binding-object that are interpreted at runtime. An object binding can be composed of segments that resolve a complex data type. The value of the final segment is also the result of the binding. Object bindings are often used in metadata to retrieve data that bound to the current context of the action or control or page. You can set object binding to any control's or action's properties that accept Object Binding as value

Simple Object Binding

Example:

Assuming your current context's binding is as follows:

{
  "OrderId": "12345",
  "ProductName": "Product A"
}

Then you can use this binding in your metadata properties:

"Title": "{OrderId}"

Complex Object Binding

You can also using '/' as separator for multi-level data structure (e.g. for Complex OData Type)

Example:

Assuming your current context's binding-data is as follows:

{
  "EmployeeID": "12345",
  "EmployeeName": "Product A",
  "Address": {
    "City": "CityA",
    "Street": {
      "StreetName": "StreetB",
      "HouseNo": "1"
    }
  },
  "Roles": [{
      "RoleName": "Role A",
      "RoleFunction": "Func A"
    },
    {
      "RoleName": "Role B",
      "RoleFunction": "Func B"
    }
  ]
}

You can bind these properties in your metadata:

"Title": "{EmployeeName}",
"Subhead": "{Address/City}",
"Description": "{Address/Street/StreetName}"

You can also bind property of an item in an array by using number in the binding path:

"Title": "{Roles/0/RoleName}"

Combining Multiple Object Bindings

You can't combine multiple object binding in a single property e.g. The following is not supported:

"Subhead": "Address: {Address/City} {Address/Street/StreetName}",

You must use Dynamic Target Path to achieve that.

Target Path vs. Binding vs. Dynamic Target Path

When specifying the value for bind-able properties in the metadata, the following are equivalent:

  • "#Property:myVar" is a "simple target path" that -- as described in this document -- will return the value of the myVar property in the current object context using the #Property segment.

  • "{myVar}" is a "regular binding specifier" that is shorthand for the target path above.

  • "{{#Property:myVar}}" is a "dynamic target path" this is commonly used to create fancy display strings by inserting them inside other strings. For example: "{{#Property:TeamName}} - {{#Property:City}}" could resolve to "Cubs - Chicago" when the client evaluates each of the inserted target paths. In this case, since it is only the one, it would resolve to the same value as the other two.

Last update: November 18, 2021