Accessing Client Side Data

  • Updated

Any Data Element that is used in the Rule Application is automatically included in the JavaScript Rule Engine to support data lookups and queries. In addition to this functionality, you can also access Inline Table and Inline Value List data directly for other uses. For example, use this data to populate a dropdown list, which avoids duplication of the values in the application and the Rule Application.

These examples show how to access this data using native JavaScript. You may also use common JavaScript frameworks like AngularJS and Knockout to bind directly to the data.

Accessing Inline Tables

To access an inline table, use the getInlineTable function.

var table = session.dataManager.getInlineTable('ProductTable', null); 
var tableLength = table.length;
for (var i = 0; i < tableLength; i++) {
var tableValue = table[i].Value;
// Do something with tableValue

Note: The second argument for the getInlineTable method above is optional. That can be used to reference a specific version of the table.

Accessing Inline Value Lists

To access an inline value list, use the getValueList and getValues functions.

var list = session.dataManager.getValueList('ColorList'); 
var listItems = list.getValues();
var listLength = listItems.length;
for (var i = 0; i < listLength; i++) {
   var listItemDisplayName = listItems[i].displayName;
   var listItemValue = listItems[i].value;
  // Do something with listItemDisplayName and/or listItemValue

See the API Reference DataManager section for more information.

Was this article helpful?

0 out of 0 found this helpful



Please sign in to leave a comment.