Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Automation Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-13-2009, 07:03 PM
ColinJD ColinJD is offline
Member
 
Join Date: May 2009
Posts: 38
Default Pass Variables between Tasks

I have a task lets say, mainTask, that runs another task say, subTask.
If in the mainTask I have a variable, eg myTaskVar = 77
I wish to pass this value at runtime to the subTask
-
' I had assumed that variables were in fact 'global' but it appears that each task uses an instance of variables.dat.
-
Suggestions welcomed
Reply With Quote
  #2 (permalink)  
Old 06-14-2009, 12:01 AM
ColinJD ColinJD is offline
Member
 
Join Date: May 2009
Posts: 38
Default Work around discovered

Via using the varibles read from Text file, I can solve this,
And I guess it also create a level of persistency with variables.
Reply With Quote
  #3 (permalink)  
Old 06-14-2009, 02:36 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

Yes, you are correct.

There are two ways by which you can pass parameter to sub task.

1) If you want to pass a single parameter, then use system variable, $Clipboard$. Before you call a sub task, assign value that you want to pass to $Clipboard$ using Variable Operation command. In sub task, assign value of $Clipboard$ to any variable using Variable Operation command. Similarly, if you wish to return value from a sub task then assign return value to clipboard and use it in the main task.

2) Create a variable that reads value from a text file lets say $GlobalVar$. Using 'Log To File' command update value of $GlobalVar$. You can use this variable in any number of sub tasks. The value of $GlobalVar$ will not change until you update the text file.

Hope that helps.
Reply With Quote
  #4 (permalink)  
Old 11-25-2009, 10:53 AM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

If using the $Clipboard$ variable, do you risk it being written to by another operation that sets the $Clipboard$ value?

For example, if I have 50 tasks running at the same time, all of them with sub tasks that set a variable to the clipboard to pass values back to the parent task, could the value be overwritten before it is read by the parent task and thus cause problems?

Thanks!
Reply With Quote
  #5 (permalink)  
Old 11-26-2009, 02:38 PM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

It looks like passing parameters to sub tasks is possible in AA 5.5, but passing them back to the parent task is the problem.

I was thinking about how to get around the clipboard and file issue (of overwriting your value) if several tasks were running at the same time and I came up with this (not tested).

Create a GUID in the parent task and pass that to the child. Then in the child, you can create a txt file to store items to you want to pass back to the parent... just name the txt file using the GUID that was passed into it... then you know that each time the task runs (even if it's running simultaneously) you are able to pass variables between sub and parent tasks with confidence. Then you would delete the txt file at the end of your task to prevent getting a bunch of them.

Just a theory... haven't tried it out myself but I don't see why it wouldn't work. For a GUID, you could probably just use the random variable generator built into AA. Just set it to give a number between 1 and 999999999999 (as many 9's as it will accept). While that is not as good as a true GUID, it is probably good enough!
Reply With Quote
  #6 (permalink)  
Old 11-28-2009, 02:22 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

Using Automation Anywhere, you can certainly return the value back to the parent task using 'Log to File' command as suggested in previous post.

If you need to run several tasks simultaneously and need to log the data in same file at the same time then it may cause the access violation issues. However, to get around this issue what you can do is, create a table say GlobalParameter in Access Database with three fields, Parent Task Name, Child Task Name and the Value Field. Now, in child task using 'Database: Insert SQL Statement' command you can insert the row into this table and log the data that you need to return to parent task. In parent task using 'Database:Select SQL Statement' command you can retrieve the logged value from GlobalParameter table.

For your reference, we have created a sample task. To run this task,

. Please copy .atmn files under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder.
. Copy .mdb file under C:\.

Hope that helps.
Attached Files
File Type: zip GlobalParameter.zip (13.6 KB, 3 views)
Reply With Quote
  #7 (permalink)  
Old 11-30-2009, 12:20 PM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

thanks, I was thinking if you named your file using the guid which is created each time the task is run you wouldn't have that problem.

I like your idea of using the database which is actually what I have implemented for logging myself... I just thought for others that don't want to connect to a database, the guid named log file might help.
Reply With Quote
  #8 (permalink)  
Old 07-20-2010, 02:56 PM
pattybal pattybal is online now
Junior Member
 
Join Date: Jul 2010
Posts: 16
Default

I have the same issue. I installed AA 6.0 because I could open your example and still I cannot edit it.
Reply With Quote
  #9 (permalink)  
Old 07-20-2010, 03:37 PM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

Run Task command in version 6.0 provides option to pass parameter to sub task.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 02:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved