Developer Partner Community

Accessing Attribute Names and Values of a Data Object by Frank Nimphius

Juergen Kress
PaaS Partner Adoption


In this quick tip I show you how to use Apache FreeMarker expressions in Oracle Intelligent Bots to list the attribute names of a data object and to access the attribute value.

Data Objects in Oracle Intelligent Bots

Chatbots interact with remote services to complete a task and to display results. In Oracle Intelligent Bots, result data objects are queried by custom components and saved to context variables in the dialog flow. To save data from a custom component in a context variable you use the following call

conversation.variable('name_of_variable', js_data_object);

The data you save may be an array of objects or a single objects. The context variable you save the information to must be defined at dialog flow design time and must be of type "string".

Accessing Attributes and Values of an Object

For this sample, we will set the data object in the dialog flow of Oracle Intelligent Bots directly to make it easy for you to reproduce the solution. The solution actually works with Oracle Intelligent Bots version 18.1.5 and above.

Note: if your data object is an array of objects then you simply add the index of the object in the array to the expressions shown below. e.g. data.value[0] accesses the first object in an array. Using Apache FreeMarker you can also determine the length of an array to iterate over all its contained objects. For the sample in this blog article, a single object will do though. Read the complete article here.


Developer Partner Community

For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.

clip_image003 Blog clip_image005 Twitter clip_image004 LinkedIn image[7][2][2][2] Facebook image Meetups

Technorati Tags: PaaS,Cloud,Middleware Update,WebLogic, WebLogic Community,Oracle,OPN,Jürgen Kress

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.