Reputation: 131
I have created an entity called @material_number and this entity has 3 values which are provided below with their respective patterns:
num1 with the pattern (\d{3}\.){1}\d{3}
num2 with the pattern (\d{3}\.){2}\d{3}
num3 with the pattern (\d{3}\.){3}\d{3}
In a dialogue node, if the bot recognizes @material_number it stores the provided user input under a context variable $materialnumber and then responds "Oh, the material number is $materialnumber".
The thing is that when the input of the user belongs to the value either num2 or num3, the bot only stores the first 6 digits provided. For instance when the input is 123.123.123.123 or 123.123.123, the bot only stores first six digits (seperated with a dot from the middle) and prompts back "Oh, the material number is 123.123".
By using JSON editor, it should be possible to overcome this confusion.
Upvotes: 1
Views: 228
Reputation: 17176
Similar to the solution suggested in this answer, you can nest ternary operators:
{
"context": {
"number1": "<? @number1:mat3 ? entities.number1[2].literal : @number1:mat2 ? entities.number1[1].literal : entities.number1[0].literal ?>"
}
}
Upvotes: 2