Condition in Server Connect not working

I’m trying to use a condition in a server connect but it doesn’t work.

In repeat1 I set the value of x to FIRST (I’ve tried using number and text), then in repeat2 I check to see if x ==‘FIRST’ and if it does set some values and also the value of x to ‘NOTFIRST’ so the ELSE condition should be run on the next iteration of repeat2. x should then be reset to ‘FIRST’ at the beginning of the next repeat1.

The THEN steps in Condition {{x==‘FIRST’}} are being run ever time and it never gets to the ELSE where it would output the here variable.

Am I missing something obvious or is this a bug?

I think this might be about scope.

Try adding a global name to the set value steps (x) something like x_global

Then use x_global == 'FIRST' in your condition - you’ll need to use code view in the data picker as it doesn’t find global names

Thanks. That, unfortunately, does the opposite. So the first condition never runs.

Just checking - the ‘first’ value should be in capitals. I updated my post above

Can you share a screenshot of what you have for your x/x_global set value step

You’ll also need to add the same global name of x_global when changing the x value inside the condition (if it gets there :wink:)

Got it. I was missing the single quotes here.

image

Thanks for your help!

1 Like

Another option is set the x value near the beginning to $index

And the condition as x_global == 0

You wouldn’t need to change it within the condition then

1 Like

Ahhhh - I didn’t think of that. Much cleaner solution. Thanks!

1 Like

Actually don’t even need to use the x value. Just $index==0 in the condition!

Just be careful, that will be the closest index. You have a repeat nested inside another. I understood from your screenshot you wanted it to be the index of the outermost one.