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 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!! :slight_smile:

1 Like

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”

ahh This is what i was looking for thanks buddy :slight_smile:

1 Like

it is showing error ) expected

@ravig1206 , can you display the expression?

If(not String.IsNullOrEmpty(a),a,If(not String.IsNullOrEmpty(b),b,If(not String.IsNullOrEmpty(dates),dates)) this is the condition

@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

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.