Throw an error - VisualCron - Forum

Community forum

ddtisysadmin
2017-08-31T14:58:53Z
I've got a job where I iterate through a loop x number of times. Essentially, it's looping through a "List File(s)" task, waiting for a file to be dropped into a folder.

I've set up the following exit conditions: (Abbreviated)

On success -> If output contains '{JOB(Active|Variable|runtime.fileName)}' (String) - Goto Task 'Next Task Name'
On error -> Stop Job
On success -> If output not contains '{JOB(Active|Variable|runtime.fileName)}' (String) - Continue with next Task
On success -> If value '{LOOP(CurrentValueX)}' Equal {LOOP(CurrentValueY)}' (Int32) - ?????


What I want to know is, what do I put in the action for the last item? I could create an inactive dummy task that is deliberately incorrect, but that's a kluge, and won't really tell what the real problem is. Is there any way to actually make it throw an error? Technically, the job is a success, because it completed, but if I get to the end of my loop, and the file still isn't present, then it's an error condition - i.e. the file never made it to the destination folder.
thomas
2017-08-31T15:40:51Z
Maybe I misunderstand the job, but if you are waiting for a file to arrive in a folder, why don't you use a file trigger?
ddtisysadmin
2017-08-31T15:46:07Z
Originally Posted by: thomas 

Maybe I misunderstand the job, but if you are waiting for a file to arrive in a folder, why don't you use a file trigger?


Good question: It's a complex job. I actually use a file trigger to start the job initially. It copies a file to a processing folder, then waits for that file to be processed (by another service) then moved to an archive folder. VisualCron will then alert us if the file hasn't processed by the "deadline," which is variable based on the number of lines in the file.

I tried, but I don't think there's a way to incorporate a second trigger into the same job. I experimented with creating a "follow up" job, but this was very messy, and ultimately didn't work, since passing the variables to the second job requires running the first task, and thus couldn't activate a trigger.

To add even more complexity, it is possible that additional (smaller) files could be dropped into this folder before the first one has completed. If I had a follow-up task, and I could somehow activate a variable file trigger, that trigger could be modified again, causing the first job to report a failure. Keeping each file within its own job makes this a reliable process.

Maybe I missed something, and I would actually prefer to use a file trigger in some way, but I couldn't figure out a way to do it.
thomas
2017-08-31T16:40:49Z
ah ok. Got it. I will have to think about this one:)
thomas
2017-09-01T10:51:59Z
Sorry, I can't really wrap my brain around the steps involved here. I dont' quite get what the "LOOP(CurrentValueX)} Equal {LOOP(CurrentValueY)}" means in the business sense.

Anyways, if what you want to do is throw an exception in a task, then there is no built in way of doing that ( I think). You could make a .NET task that takes a parameter (errorMessage), and throws an exception with this message. That's the closest I can think of.
ddtisysadmin
2017-09-01T12:40:05Z
I believe I figured out a successful way to raise an error (with the "On Error" tab in the task) if the output of the task doesn't match an expected value. So, rather than putting it in the "Flow" tab, I went to the "On error" tab, and selected "Raise error" -> "If output" -> "String Not contains !=%" -> "Name of file."

I have no idea if I'm using that tool right, but so far, it seems to be doing what is expected.
Support
2017-09-01T20:06:35Z
We can close this one right? It was resolved through chat?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ddtisysadmin
2017-09-01T20:17:43Z
Yes - I believe I have this functionality working. Still struggling with a couple other problems, but not related to this issue.

After I figured it out, this functionality exists - You can throw an error by checking the output of the operation you're doing. (So long as you have an idea what the expected output should be.)
Users browsing this topic
Scroll to Top