The objective of Mapping Editor is to map data across widgets and service parameters. This mapping of data reduces the effort of writing code.
Mapping Editor is made up of two major parts:
The source appears on the left hand side of the mapping editor window as shown in the above window. The Source consists of the following:
Note: i18n Keys appear only in the source because you cannot assign any value to them once they are defined.
The target appears on the right hand side of the mapping editor window as shown in the above window. Target consists of the following components:
The elements under Source and Target in the Mapping Editor can be sorted by two ways:
displays all the elements
displays only the i18n keys
displays only the skins
displays widgets sorted by their ID
displays widgets sorted by their categories
displays only variables - local and global variables
displays the elements that match the search string
You can use the Add a form/ template to the tree button to add additional entities to the Source or Target in the Mapping Editor. You can add the following categories to the Source or Target in the Mapping Editor:
To add a category to the source or target of the Mapping Editor:
The Mapping Editor is invoked in case of the following action items in the Action Editor:
Invoking a service (Synchronous or Asynchronous). The form from which the service is invoked becomes the source, and the invoked service is the target. For more information, see Network APIs Actions.
Navigating to another form. The form or service from which you are navigating is the source, and the form to which you are navigating is the target.
Mapping within the same form. The source and target is the same form in this case. For more information, see Map Widget Properties to One Another.
While mapping data from source to target, you must be aware of the following:
For service mappings, do not use structures that have more than simple key value pairs and attributes. Break out complex structures and use code to get the lost values.
Kony service mappings can not support dynamic associations or hierarchical structures. Use code to work around this limitation
Note: The Mapping Editor supports one-to-many mapping, that is, you can map the same element in the source to multiple elements in the target.
To perform mapping in the Mapping Editor, do the following:
Note: The data type should be the same for source and target.
The items that are mapped are highlighted in yellow as shown below:
If you try to bind two items that do not meet the mapping criteria, for example a string to a number, you get an error message as shown below:
Note: When you unbind a collection, all the elements within the collection are unbound automatically.
You can also map data to widgets or service parameters by creating an expression. When you write an expression to map the data, you can perform the required operations on the data before mapping it to the selected element.
To map data with the help of an expression, do the following:
Note: You can add an expression only to the elements that have a data type associated with it. These elements can be service parameters or attributes of a widget. You cannot add an expression at the widget name or service name level.
The Expression Editor appears.
When you want to map elements within a collection to a widget or a service parameter, the first element in the collection gets mapped to the widget by default as shown below.
Note: You have to explicitly edit the expression to modify the index of the collection that needs to be mapped.
To edit the collection index value, do the following:
Copyright © 2013 Kony, Inc. All rights reserved. |