Switch activity used to enact a workflow based on the file which is open

Hi all,

I have a process which opens an excel file from the Orchestrator queue, and then depending on which excel file it has open, performs different actions. For this I used a switch rather than nested if functions, however it doesn’t seem to work as is, so was looking for some help please.

image

The file opens, then the process skips the switch activity altogether. The file names are more complex than the single words, but these are the unique identifier words, and *wildcards don’t work with .contains as far as I know. TypeArgument is also a String.

I’m sure it’s something very simple I’m missing so please let me know.

Many thanks,

Alex

1 Like

Hi @Alex_Cross

Yes… the way you have configured your Switch activity is bit wrong :slight_smile:

For the expression, just use the variable name as it is. - you have already done it and it looks fine.
Change the Type Argument of the switch activity to String
Now, in every case, just mention the value you are looking for in the variable. You don’t need to write the code there.

One example is as follows

This will work exactly as it is…

Let know if this works for you…

1 Like

Buddy the reason is the contains actually gives us true or false boolean type of value
and when you are passing an expression strFileToOpen of type string and getting compared with case value of type boolean…there comes the mismatch buddy… @Alex_Cross
so in order rectify this let the expression be same with strFileToOpen and in cases pass all the values of file name that you have in orchestrator…so
if the strfiletoopen with string when gets compared to the case value of type string…which actually has any one of the value of strfiletoopen,will match and get you to that case and related activities in it
Try this buddy and let know whether this works or not buddy
Cheers @Alex_Cross

1 Like

Thanks both for your help, looks like I’m half way there now! As you can see below, it opens the files (when I logged into the VM all 5 excel files were open) but it doesn’t seem to perform any of the required processes, much like before, except this time at least it doesn’t error, just skips past and ends transaction with no errors?

Studio:

Orch Logs:
image

Any help is appreciated, thanks!

Alex

1 Like

Hi Alex

Remove all the speech marks from your Cases. The switch is trying to match “Demand” rather than Demand which is causing it to follow the default case. That is why you aren’t getting any errors

I had the same issue with a switch recently

1 Like

Buddy thats great
you were almost done
but one this make sure you have type argument of switch case as string
and if so dont put double quotes for any string in any of the cases
remove that buddy and try
you will get it for sure
see for example when i tried like this i didnt get any thing


but when i removed the double quotes

@Alex_Cross

Cheers @Alex_Cross

1 Like

did that work buddy @Alex_Cross

Running now, just had to update something else.

Many thanks, I’ll let you know, but it looks like it :smiley:

1 Like

sure buddy @Alex_Cross

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