Data action result not matching in switch statement

My data action returns below which I have tested from the GUI.

{
"Status": "Scheduled",
"Error": "",
"Success": true
}

The value of status is stored in architect variable Flow.Status. which is further checked in a switch block expecting the below switch case to be evaluated to be true.

AreEqual(true,Flow.Status, "Scheduled", "Work Scheduled")

But on the contrary, its always goes to the default case.

The strange thing is - this only happens with the Scheduled status. All other statuses e.g. Open/Approved By Client goes to below case

AreEqual(true,Flow.Status, "Open", "Approved By Client")

Closed/Completed goes to below case

AreEqual(true,Flow.Status, "Closed", "Completed")

I have made sure there are no spaces around the value of the status. Even I copied the actual word Scheduled coming in the response of the data action and pasted it in the switch statement condition but still it goes to the default case.

Please help me identify what's wrong here.

Regards,

Hi @SajidAbbasMalik
I'm wondering if splitting these cases out into separate cases would solve your problem. Unless I'm missing it, looking at the documentation for AreEqual, I don't see an overload that compares the second parameter (valueToCompare) to any of the following parameters (vs. checking equality to all the following parameters).
For instance, AreEqual(true,Flow.Status, "Scheduled", "Work Scheduled") would become two cases, one being AreEqual(true,Flow.Status, "Scheduled") and the other being AreEqual(true,Flow.Status, "Work Scheduled")
Then you could handle both cases in the same way. Then you could apply the same method to the other cases and see if that changes anything for you.

1 Like

All of those expressions should return false. Scheduled != Work Scheduled because it's 5 characters too long.

Do want to know if Flow.Status is one of Scheduled or Work Scheduled? In that case do something like this

Count(Find(MakeList("scheduled", "work scheduled"), Lower(Flow.status))) > 0

1 Like

Thanks Jacob, AreEqual does have an overload which can take multiple parameters and do the comparison.

Thanks Melissa, I did resolve my problem by using == instead of AreEqual but contrary to what you said

All of those expressions should return false. Scheduled != Work Scheduled because it's 5 characters too long

Only expression with status Sheduled/Work Scheduled resulted in false. Rest worked fine. Anyways, Thank you so much for the suggestion to use Count(Find(MakeList..... expression. This will definitely help me in future.

@SajidAbbasMalek
Correct, but the distinction I was making is that AreEqual compares the second parameter to all of the following parameters, not any. Glad you were able to resolve it.

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