ravig1206
(Ravi Gupta)
May 29, 2023, 11:09am
1
Variable assignment - I have 4 variables but only one variable will always have value. I want a condition in type into activity which types only that variable which has value.
variable A , B , C , D are variable .
suppose C has only value so I want a one liner code which checks and type only value which is in C
Try using a For each activity that iterates through your variables and then have an If condition that checks if it has the value or not.
Let me know if this helps, Cheers!!
1 Like
ravig1206
(Ravi Gupta)
May 29, 2023, 11:13am
3
this is little complex but there is a way with which we can write just one line code and it uses only that variable which has value.
Hi @ravig1206 ,
Use the nested if statement to check if the variable has the value.
Eg:- if(not string.IsNullOrEmpty(a),a,if(not string.IsNullOrEmpty(b),b,next condition if any ))
Regards,
1 Like
Try using what I said above and put in the if condition “CurrentItem <> null”
ravig1206
(Ravi Gupta)
May 29, 2023, 11:30am
6
ahh This is what i was looking for thanks buddy
1 Like
ravig1206
(Ravi Gupta)
May 29, 2023, 11:41am
7
it is showing error ) expected
@ravig1206 , can you display the expression?
ravig1206
(Ravi Gupta)
May 29, 2023, 11:43am
9
If(not String.IsNullOrEmpty(a),a,If(not String.IsNullOrEmpty(b),b,If(not String.IsNullOrEmpty(dates),dates)) this is the condition
ravig1206:
If(not String.IsNullOrEmpty(a),a,If(not String.IsNullOrEmpty(b),b,If(not String.IsNullOrEmpty(dates),dates))
@ravig1206 , you have missed out one bracket at the end and a default value if any of your variables does not have any value:
If(not String.IsNullOrEmpty(a),a,If(not String.IsNullOrEmpty(b),b,If(not String.IsNullOrEmpty(dates),dates,"")))
1 Like
system
(system)
Closed
June 1, 2023, 11:48am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.