Bot Framework Composer v1.4.1
I have a bot connected to Luis, which returns a list entity that I need to operate with that data. The entity that I get is a list of categories, and I need to concatenate all the elements of that list into a string
"entities": {
"CategoryList": [
[
"sub-13-Imprimante",
"12-materiels"
]
]
}
The expected result is
"sub-13-Imprimante,12-materiels"
I have tried different options but none concatenate the result as expected.
@CategoryList //This only assign first element of the array ("sub-13-Imprimante")
join(@CategoryList, ',') //Throw error
The error obtained in the join statement is:
System.InvalidOperationException: 'NewTicket.fr-fr.lg:@CategoryList evaluates to sub-13-Imprimante which is not a list. [SendActivity_D8EXfc] Error occurred when evaluating '- ${join(@CategoryList, ',')}'.
It would seem that when calling @CategoryList, it already returns the first item, instead of the entire list.
How could I do to obtain all the values of the array concatenated in a string?
@CategoryList
will return the first and only the first value found for the entity. @@CategoryList
will return the entire thing. So, what you need is join(@@CategoryList, ',')
See more info here:
https://learn.microsoft.com/en-us/composer/concept-memory?tabs=v2x#memory-shorthand-notations