Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Xander Meadow
2022-07-15T17:18:20Z
Hi all,

I'm trying to figure out if there is something like a switch, case or select statement in Visual Cron. My specific case is I'm updating a job variable based on it's current value so I can loop through a series of tasks. I can do this with the current LOGIC statement
Sponsor
Forum information
bweston
2022-07-15T18:17:08Z
To accomplish the approach it sounds like you're describing, I personally would probably use a powershell task to implement the switch statement and then a set variable task based on the powershell task output. Or maybe set the variable using a notification on the powershell task. I haven't tried that.

To accomplish the result it sounds like you're describing, I would probably have a (job) variable holding the values to loop through, one per line, and then...a Visualcron loop to run through them.

I have a suspicion that your use case is going to be more complex than I am able to gather from your description, though, in which case that loop idea might be completely unhelpful.
Xander Meadow
2022-07-15T18:29:21Z
Thank you so much for the reply. When you say have a job variable hold the values one per line and then a loop to move through them, can you explain that a bit more? I don't quite understand it, but it sounds really interesting. If I'm understanding correctly, the job variable that I currently have would have all the portfolios in it at the beginning instead of being updated at the end of each loop. So it would look like this:

port1
port2
port3

instead of

port1

Then I can use a Visual Cron loop to pull the correct line out of that variable? That sounds like it would work, but how do I pull the correct line out of the job variable? Thank you again.
Xander Meadow
2022-07-15T19:17:50Z
That's very cool! Thank you so much for the help pointing me in the right direction. I updated the loop to use the for each x in y and then set the for each row x in my new job parameter. Then in the rest of the loop I can just use {LOOP(CurrentValueXArray|0)} as the value. When I need to make changes I just update the job parameter. Thank you thank you, this is perfect and a very neat way to loop through a list.
Scroll to Top