Accessing/Updating VisualCron Variables Within .NET Task - VisualCron - Forum

Community forum

ben.dixon
2016-08-25T13:45:33Z
Hi all,

I've got a job that has a SQL task that returns a comma-delimited list of values. For each value I need to make an API call using the HTTP task. To parse the comma-delimited list I have a .NET task with some simple string parsing code to create an array of the values from the comma-delimited string input. The .NET task and the HTTP task are contained in a loop. My hope was to parse the list, set it in a user variable, then decrease the size of the list for each iteration of the loop.

My question is, within the .NET task is it possible to update the value of a VisualCron user variable so that I can maintain the state of the list as it is reduced at each iteration? I have seen snippets of documentation on the API and some samples but all of them require creating a client and server object then connecting to VisualCron as most of the samples are for external access to VC from a custom app. I'm thinking there must be a way to use the implicit connection between the task and the VisualCron server to avoid having to create client/server objects within the task. Somewhere in my searches I saw an object called "VisualCronServer" that makes me think this is possible. Any help, hints, or pointers to complete documentation are much appreciated.

Thanks,

Ben
Support
2016-08-25T19:03:57Z
I do not think you need to "decrease the size" as there will be a new line in each iteration and that you only need to parse the line. Once parse you can either use the value from the .NET Task or value from any "column" in the iteration - so I do not think you need to work with Variables at all?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ben.dixon
2016-08-25T19:09:29Z
Hey Henrik,

To clarify my input, it is one line returned as the result of stored proc call. It looks like this: A,B,C,D. You're suggesting that I process the data line by line. I could modify the output of the stored proc create rows instead of a single line output. Is there an example of how this would work somewhere? How would I link the rows in the result to the input of my string parser? Besides splitting the string on commas I will need to do some other string manipulation as well to ready the text for the call to the web API.
Support
2016-08-25T20:27:38Z
To handle this you need to put following Task(s) in a loop. Then you have automatic handling of this. So, if you new line delimiter is comma there will be 4 iterations A, B, C and D. Is that not what you want?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ben.dixon
2016-08-26T12:03:44Z
Originally Posted by: Support 

To handle this you need to put following Task(s) in a loop. Then you have automatic handling of this. So, if you new line delimiter is comma there will be 4 iterations A, B, C and D. Is that not what you want?



Hi Henrik, I understand what you mean now. I have set the loop to "For each X in Y" type with a line break of comma. How do I reference the row variable in the other tasks in the loop. For example, for my .NET task that takes the row value from the SQL output, what VC parameter would I bind to my method parameter? With that knowledge I should be able to complete this work.

I very much appreciate your help.

Ben
Support
2016-08-26T12:32:06Z
I am attaching a screenshot of where you can find all Variables.

loopvariables.png
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top