- Newest
- Most votes
- Most comments
The issue with your conditional expression in Amazon Lex V2 is that the fn.IS_SET() function is a Boolean function that returns true or false, and it should not be compared to a string ("TRUE"). Instead, you should directly use it in your condition.
Correct Expression:
fn.IS_SET({matricula})
For negation:
!fn.IS_SET({matricula})
I don't know why the re:Post Agent said:
Secondly, the IS_SET() function is used without the "fn." prefix in Lex V2 conditional expressions.
But it was clearly written on the documentation that:
Other Common fn. Functions
| **Function | ** Description |
|---|---|
fn.IS_SET({slot_name}) | Checks if a slot is filled. |
fn.EQUALS({slot}, "value") | Compares a slot value with a given value. |
fn.CONTAINS({slot}, "substring") | Checks if a slot value contains a substring. |
fn.AND(condition1, condition2) | Returns true if both conditions are true. |
fn.OR(condition1, condition2) | Returns true if at least one condition is tr. |
Thank you for providing the details about your issue with defining a condition in Amazon Lex V2. It appears there are a couple of issues with the conditional expression you're using.
First, the function IS_SET() in Amazon Lex V2 doesn't require comparison to "TRUE". The function itself returns a boolean value, so you can use it directly without the equality comparison.
Secondly, the IS_SET() function is used without the "fn." prefix in Lex V2 conditional expressions.
To correctly check if a slot contains a value, you should use the following format:
IS_SET({matricula})
This expression will evaluate to true if the 'matricula' slot has a value, and false if it doesn't.
If you want to combine this with other conditions, you can use boolean operators. For example:
IS_SET({matricula}) AND {dni} = "some_value"
Make sure that both 'matricula' and 'dni' slots are defined in your 'DarMatriculaDNI' intent. If you're trying to use a slot from a different intent, you would need to specify the intent name as well, like this: {IntentName.SlotName}.
By making these adjustments, your conditional expression should work correctly in your Amazon Lex V2 bot.
Sources
Add conditions to branch conversations - Amazon Lex
Set values during the conversation - Amazon Lex
Relevant content
- asked 3 years ago

IS_SET({matricula}) does not work. I am getting this error: Invalid conditional expression in slot 'dni' of intent 'DarMatriculaDNI'. Invalid expression: IS_SET({matricula})