Crow Canyon Software Forum
Advanced Conditions on Variable Value
Quote from jlazzaro on November 10, 2023, 12:13 pmI'm trying to use an Advanced Condition in a conditional to see if a variable (set earlier by regextract) has a length greater than 5. Here is my condition syntax:
Advanced Condition greater than $strlen(varEMPLID##Value),,5
When the workflow runs, I see that the string length is greater than 5, but the condition always evaluates to false, whether the string length is greater or less than 5.
=================Begin action execution ...=================Action Title: Check for emplid queryAction Type: GatewayColumn type: "Advanced column"Condition evaluation information:-----------------Column value: "7"Operator: "Greater Than"Condition evaluated value: "5"-----------------Result: false-----------------Condition evaluation result: falseConditions evaluation result: falseConditions matched: "false"Successfully Executed
I'm trying to use an Advanced Condition in a conditional to see if a variable (set earlier by regextract) has a length greater than 5. Here is my condition syntax:
Advanced Condition greater than $strlen(varEMPLID##Value),,5
When the workflow runs, I see that the string length is greater than 5, but the condition always evaluates to false, whether the string length is greater or less than 5.
Quote from James Restivo on November 10, 2023, 12:42 pmHi @jlazzaro,
You can't directly use functions in the Advanced Condition. The best way to handle this is to use a Set Variable action for the $strlen function to map the value to either new variable or the same variable (if you don't use the variable later in the Workflow). You can then use that new variable (e.g. EmpIDLen) in the Advanced Condition, like EmpIDLen##value,,5
See if that works and let me know.
Hi @jlazzaro,
You can't directly use functions in the Advanced Condition. The best way to handle this is to use a Set Variable action for the $strlen function to map the value to either new variable or the same variable (if you don't use the variable later in the Workflow). You can then use that new variable (e.g. EmpIDLen) in the Advanced Condition, like EmpIDLen##value,,5
See if that works and let me know.
Quote from jlazzaro on November 10, 2023, 1:12 pmThanks for the quick response! That doesn't seem to work either unless I'm missing something else. I notice that the result of setting varIDLength is 7, not in quotes, while the advanced condition is showing both 7 and 5 in quotes. Is it possible that it's trying to do a numeric comparison but treating the values as strings or am I reading too much into the log formatting?
Set varIDLength to $strlen(varEMPLID##Value)
Advanced Condition greater than varIDLength##Value,,5
Debug Log:
=================Begin action execution ...=================Action Title: Set ID Length for EMPLIDAction Type: SetVariableValueVariable: "varIDLength"Expression: $strlen(varEMPLID##Value)Expression Value: 7-----------------Successfully Executed=================Begin action execution ...=================Action Title: Check for emplid queryAction Type: GatewayColumn type: "Advanced column"Condition evaluation information:-----------------Column value: "7"Operator: "Greater Than"Condition evaluated value: "5"-----------------Result: false-----------------Condition evaluation result: falseConditions evaluation result: falseConditions matched: "false"Successfully Executed
Thanks for the quick response! That doesn't seem to work either unless I'm missing something else. I notice that the result of setting varIDLength is 7, not in quotes, while the advanced condition is showing both 7 and 5 in quotes. Is it possible that it's trying to do a numeric comparison but treating the values as strings or am I reading too much into the log formatting?
Set varIDLength to $strlen(varEMPLID##Value)
Advanced Condition greater than varIDLength##Value,,5
Debug Log:
Quote from supportTeam on November 14, 2023, 11:27 amHi @jlazzaro,
Please edit the workflow -> Modify gateway condition as shown below -> Save gateway settings -> Publish the workflow and check the result.
Condition:
Advanced Condition ‘greater’ $strlen(VariableName##value),,5,,Number
<Screenshot attached>
Hi @jlazzaro,
Please edit the workflow -> Modify gateway condition as shown below -> Save gateway settings -> Publish the workflow and check the result.
Condition:
Advanced Condition ‘greater’ $strlen(VariableName##value),,5,,Number
<Screenshot attached>
Uploaded files: