article by Frank Nimphius, September 2020
Sometimes small nuggets turn out to be more valuable than the bigger ones. Hope this is one of those little tips that you will enjoy and use. So in this quick tip I explain how you can add character shortcuts to values lists in Oracle Digital Assistant. Basically I show you how to go from this:
To this:
The trick is to use Apache FreeMarker expressions in a System.CommonResponse component. The System.CommonResponse component can be used to display list of values and card layouts from arrays and lists. For the the sample, I created an array of colors as shown in the image below
Then in the System.CommonResponse component, I used the colors variable as a reference in the iteratorVariable of the actions node to print the list of values.
The highlighted BotML shows how you create the character short cuts. In the keyword field (you can define many keywords using a comma separated list if you like) I used the following Apache FreeMarker expression to turn the current printed item's index number into a character keyword
${(colors?index+1)?lower_abc}
To make the keyword obvious to the use, I added the same to the button label
${(colors?index+1)?lower_abc}. ${colors}
Really simple. This also works with lists created from value list entities.
Related Content
TechExchange – Using Apache Freemarker Expression in Oracle Intelligent Bots
TechExchange Quick-Tip: Sorting Entity Derived Lists
TechExchange-QuickTip: Creating Multi-Select Lists in Oracle Digital Assistant
TechExchange Quick-Tip: Printing Multi-Line Text Messages from an Output component