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
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 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.
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.