Philip_Hagenfeldt | 2021-10-07 07:47:21 UTC | #1
Hi,
I have been looking for a way to check if a script variable is empty in a if/else expression, but haven't found any clear guidance.
Is it possible to check for null values by below structure, and setting the right hand side to Text Expression?
If {{variable}} Does Not Equal (Ignoring Case) NOT_SET
Or should it be done in a different way?
jacobshaw | 2021-10-07 18:16:28 UTC | #2
Hi Philip You should be able to create a dynamic variable with type True/False whose value is the length of your variable. For example, a variable named "variable" could have a corresponding dynamic variable "variableLength" with the value length({{variable}}). Then your if/else could check that variableLength is greater than 0.
Philip_Hagenfeldt | 2021-10-08 03:15:23 UTC | #3
Hi @jacobshaw,
That's a good work around, and would most definitely work! I actually got it working by using my proposed solution, or so it seems at least.
So I guess an if/else statement within the actual dynamic variable to set true if > 0 else false? Would be useful when I don't want to build an action in Scripts, and I can actually come up with a few use cases already. Thanks!
system | 2021-11-08 03:15:30 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 12284