This only relevent to IBM Watson Conversation users.
I am trying to set a context variable to the only "valid" date the user enters in the @sys-date property. A valid date here is after 01/01/1900 and before now. According to SpEL definition I should select the list with .?[value > expression]
. Where value or #this is the current list item.
"context": {
"date": "<? @sys-date and @sys-date.values ? @sys-date.values.?[value.after('1900-01-01') and value.before(now())] : null ?>",
"thisWorks": "<? {0,1,2,3,4}.?[false] ?>",
"thisDoesNot": "<? {0,1,2,3,4}.?[value > 1] ?>"
}
thisWorks = []
Everything else throws an error.
I have tried using #this
but watson translates to (intent == 'this')
and escaping like \#this
throws an error before even trying to save.
IBM says it supports SpEL and part of the definition is collection selection. Even in this blog post it says this type of feature is supported. However there are no examples of it and everything I have tried results in errors.
Has anyone else used collection selection in Watson Conversation and provide an example?