[Solved] Reference a different task within this job (but not prevtask) - VisualCron - Forum

Community forum

Madeleine
2014-12-05T12:36:49Z
Hi there
Is there a way to reference a different task from within the same job - other than the previous task.

In my job I have a log task that needs the results of an FTP task that is 2 tasks before:

1. Move files to processing folder
2. FTP Upload files
3. Delete oldest log record
4. Log files uploaded in Task 2
5. Move files from processing folder to archive folder
6. Log files moved in Task 5

So I can reference Task 5 from Task 6 using the PREVTASK variable, but can I reference Task 2 from Task 4?
Currently I'm using a DIRECT task ID which is a pain as I have several clones of this job and have to change the DIRECT task ID for each one.

Many thanks
Madeleine
Sponsor
Forum information
Support
2014-12-05T14:49:46Z
You can use the following:

Active
PrevTask
Task Id
Task order

I think the last one might help you.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Madeleine
2014-12-05T15:28:09Z
Thanks Henrik
Is there a minimum VisualCron version for this functionality?
We are currently on 7.1.5 and I can see only Direct Id, Active, and PrevTask under Variable Key in Variables
Madeleine
Support
2014-12-05T15:33:06Z
7.0.9 is the minimum version for using Order property.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Madeleine
2014-12-05T15:37:26Z
Thanks, that's good to hear. Sorry to pester you, but could you please give an example of the syntax here, as I can't seem to find reference to it in the variables window - just how to reference the result of Task 2 from within Task 4, for example...
Many thanks
Madeleine
thomas
2014-12-08T09:40:13Z
Follow the steps

1) Click on variables

2) Choose the VisualCron variables menu

3) Find your job in the list of jobs

4) Find the task in the submenu under the job you picked in 3)

5) Click on Output in the submenu under the task you picked in 4)

6) Copy the Variable key. Looks something like this: {TASK(0ec4053c-767e-4cc0-917b-81f641f44e77,StdOut)}
Madeleine
2014-12-08T10:16:52Z
Thanks for this, but in fact that's what I'm already doing.
What I would like is a generic way to reference 'Task n in this job'
as I have several similar jobs, cloned from one original
If I could refernece 'Task n in this job' rather than using the 'global unique' ID of the task, I wouldn't have to edit the Task ID when I clone a new job.
Is there any way to do this?
Thanks
Madeleine
thomas
2014-12-08T10:57:36Z
Hi

I dont think it is possible, but I am not sure. Instead of having many similar jobs, you could have one generic job, and pass info to it through job variables. That would be through the task Internal - Job / Task Control. the output could the be passed as a job variable (like calling a function with parameters)

Thomas

Support
2014-12-08T13:38:21Z
Originally Posted by: Madeleine 

Thanks for this, but in fact that's what I'm already doing.
What I would like is a generic way to reference 'Task n in this job'
as I have several similar jobs, cloned from one original
If I could refernece 'Task n in this job' rather than using the 'global unique' ID of the task, I wouldn't have to edit the Task ID when I clone a new job.
Is there any way to do this?
Thanks
Madeleine



As mentioned before you can reference to Task n. For example:

{TASK(1,Name)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Madeleine
2014-12-08T14:05:36Z
Thanks Henrik
Sorry but I still don't see this.
What is Name referring to in TASK(1, Name)

and I still don't see the 'Task order' option in the Variables window as mentioned in your previous post:
Active
PrevTask
Task Id
Task order

Please can you give another example?

Many thanks
Madeleine
Madeleine
2014-12-08T14:14:00Z
Hi Henrik
I had another try and I can get the Name of the task as you suggested, like this:

{TASK(2,Name)} - evaluates to 'List Scripts'

But what I need is the Result of Task 2

When I try {TASK(2,Result.NoFiles)}
I get 'Error in Argument'

Is it possible to reference the task-specific results in this way?
Thanks
Madeleine
Support
2014-12-08T14:49:20Z
Originally Posted by: Madeleine 

Hi Henrik
I had another try and I can get the Name of the task as you suggested, like this:

{TASK(2,Name)} - evaluates to 'List Scripts'

But what I need is the Result of Task 2

When I try {TASK(2,Result.NoFiles)}
I get 'Error in Argument'

Is it possible to reference the task-specific results in this way?
Thanks
Madeleine



Just tested this and {TASK(2,Result.NoFiles)} worked for me. But:

1. do you really have 2 Tasks
2. and is the second Task really a List Files Task or Task that supports this Variable?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Madeleine
2014-12-08T16:33:47Z
Thanks Henrik
Answer is yes to both of your questions
But Good News!
Although I still see the 'argument error' in the variables window, the expression does work when I run it.
So I'm happy 🙂
Support
2014-12-08T16:35:07Z
Yes, this is because it is a runtime value - so it cannot be previewed.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top