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


kenigm
2016-12-01T00:20:28Z
I am trying to assign a file name to a variable.
If I use the task "List Files" and limit it to 1 result, the file name is placed in the output for that task.
How do I get that "file name" assigned to a job variable (or user variable) so that I can use it for next task as an argument for a perl script or batch command execute task?
Please help me?😕
Sponsor
Forum information
Support
2016-12-01T07:43:44Z
The output of previous Task is stored in {TASK(PrevTask|StdOut)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
David Finkelstein
2023-10-11T20:33:06Z
Problem with this is often that same data needs to be used later in the job and you need to assign to a variable. Sure it can be done but it would be nice not to have to add another task to accomplish something like this.
Xander Meadow
2023-10-24T20:25:17Z
Can you use the Direct ID option when grabbing the variable, instead of PrevTask|StdOut? So it would look more like {TASK(<some large alphanumerical string>|StdOut)} and then use that variable multiple times throughout the rest of your job? That value should not change as you progress through your job in the way PrevTask|StdOut will. HTH.

bweston
2023-10-25T17:05:38Z
Actually, I'm pretty sure it CAN change, if the job is allowed to run while it is already running. I think this is related to your problem in your other thread.
Joey S
2023-10-25T21:25:59Z
if Task #1 is List Files and that Output is a single file (or you make it that way)
then Task #2 is Set Job Variable
in that task - under Set Job Variable : Name/Unique Key = whatever you want.. Let's pretend you call it "My_variable"
I suggest no spaces or weird characters and underscores if needed.

Your "value" would be {TASK(PrevTask|StdOut)}
-obviously, at this point Task #2 has to directly proceed Task #1

Make sure to set your Job (at the top) as the job name you are in.

That variable exists only inside of that job and cannot be used elsewhere and will be that initial value until you change it.
Alternatively Task #2 could be Set User Variable. That variable could be used across all jobs or even for other jobs on other VC servers on your network.

Scroll to Top