Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Reusable code/functions/task
Topic Summary: Trying to understand the concept within AutoMate
Created On: 07/21/2015 01:54 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 07/21/2015 01:54 PM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

Hello -

I've done a fair bit of programming so I'm familiar with the concept of code re-use, but for some reason I seem to be stalled with doing it in AutoMate.

What I've been contemplating is this:

We have a lot of data transfer jobs we execute against an AS400 mainframe to pull down data. To do so we execute a native tool (external) to perform the data transfer from the AS400. Each time I create one of these jobs, I re-use the same code by copying/pasting into a new task and modifying the task according to the specific need for that job.

I'd really like to create a single, reusable task that does the data transfer by passing in respective variables. But, how do I do that and then use it within an existing workflow? If I have variables within the task I want to reuse - how do I assign values to them from a parent workflow? Do the same variables have to exist in both the workflow and the task?

Hopefully I'm not making this more difficult than it should be but I feel that I am.

Thanks!

James



 Category Survey
AutoMate BPA Server 9 version: 9.0.5
Windows version: Windows Server 2008 R2


-------------------------
<html />
 07/22/2015 01:43 PM
User is offline View Users Profile Print this message

Author Icon
AdamConner
Journeyman (50-99)

Posts: 55
Joined: 02/20/2014

We've run into similar situations and have kind of created created what we call "Shared Tasks" to simplify and re-use code. Our Shared Tasks are basically a regular task that can be plugged into multiple workflows and leverages Shared Variables (found in the WF Designer Pane) to pass data between tasks/WF's. I find Shared Variables a huge help for things like this as well as debugging.

For your situation, you could setup a Shared Var to receive input from one Workflow (or a "Shared Task") and then setup the Shared Var to pass/receive the Share Var value to another another WF or vice versa.

If you right click a Shared Var > Edit > Advanced Tab you can view options for passing variables to/from sub-workflows. Using this in conjunction with Shared Vars and re-usable Tasks really enhances what you can do in BPA. 



 Category Survey
AutoMate BPA Server 9 version: 9.0.5
Windows version: Windows Server 2008 R2
 07/27/2015 06:49 AM
User is offline View Users Profile Print this message

Author Icon
Alex Escalante
HelpSystems

Posts: 871
Joined: 02/26/2014

Hello John,

As Adam mentioned, shared variables will allow your workflows to become dynamic and customizable. You can create an initial task which can populate the shared variables with the appropriate information. Once those shared variables are populated, you can then carry out your tasks as normal. Here is more information on shared variables:

http://www.networkautomation.c...ared_Objects_Pane.htm

Please let us know if we may assist in answering any followup questions you may have.

 Category Survey


-------------------------

Alex Escalante | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
 07/29/2015 08:40 AM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

Thanks Adam and Alex.

I've worked with shared variabled before, but each time I do it seems I have more questions.

The problem I have had in the past with shared variabled is that they don't seem to be available when running a task directly or in debug mode. So, I end up  created variables local to the task just so I can populate expected values.

So let's say I have a workflow with 2 tasks. Each tasks requires a common input variable - let's say it's a directory location. So, in the workflow designer I create a shared variable named mySharedPath to reference a directory - we'll populate it with "D:\MyAutoMateTestPath". In each task - what's the proper way to reference this shared variable? Can I reference the variable directly, or should I create a local variable and assign it the shared variable as %mySharedPath% ?

Also - what's the typical way to run tasks directly (outside of a workflow) or in debug mode when the shared tasks are not available?



 Category Survey
AutoMate BPA Server 9 version: 9.0.5
Windows version: Windows Server 2008 R2


-------------------------
<html />
 07/31/2015 03:32 PM
User is offline View Users Profile Print this message

Author Icon
Valentineo McGowan
HelpSystems

Posts: 766
Joined: 09/03/2013

Hello James,

1 The variable being referenced needs to exist on the shared variable level within the workflow AND in the task in question.
2 This way when you are running the task in Debug you can see the task execution using the variable as normal.
A You also see the variable being passed when you run the entire workflow from the WFD itself by selecting RUN.

 Category Survey


-------------------------

Valentineo McGowan | Technical Consultant
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1 213.738.6966 | F: +1.213.738.7665
 08/07/2015 03:37 AM
User is offline View Users Profile Print this message

Author Icon
StuartNelson
Student (5-19 posts)

Posts: 10
Joined: 08/07/2015

Stupid related question but can't find an answer anywhere:

I am using Server version (BPA9).
I want to call one Task in a Workflow multiple times from another Task.

On the PC version, the "Start Task" action allows you to do this.
It has the option "Start A Managed Task" and you can select from drop down.

However on the Server version this option is missing.
The option "Task File To Start" is present only, but not the one I need.

Am I missing something really obvious (I am relatively new to AutoMate)???



 Category Survey
AutoMate BPA Server 9 version: 9.0.4
Windows version: Windows Server 2003
 08/07/2015 09:05 AM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hi Stuart,

In BPA you can use the Repository in WFD to pull over the task in question. You can then add it to your workflow by clicking and dragging and connecting it to your task with an arrow.

Let us know if this helps you.

 Category Survey


-------------------------

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 08/10/2015 02:05 AM
User is offline View Users Profile Print this message

Author Icon
StuartNelson
Student (5-19 posts)

Posts: 10
Joined: 08/07/2015

Thanks Ricardo

I can already do that though, what I need is a task that's not linked by an arrow that can be called multiple times as a child task from the parent task through a loop.

In this instance we have a connection to an Oracle database using a system password we do not have access to. The idea being the Oracle connection is self contained in it's own Task and can be called as required by the main process Task using Workflow variables to pass the information.

I've got this to work as part of a linear chain but this only allows the Tasks to be run in sequence.

I have an imported Task from AutoMate 7 which has the code I need however attempting to run this on BPA9 results in the error message "Starting a managed task is not currently supported in BPA Server". It seems bizarre that running another Task in this way would no longer be supported given that this is a newer version, so surely there's another way to do it?



 Category Survey
AutoMate BPA Server 9 version: 9.0.4
Windows version: Windows Server 2003
 08/10/2015 09:52 AM
User is offline View Users Profile Print this message

Author Icon
Valentineo McGowan
HelpSystems

Posts: 766
Joined: 09/03/2013

Hello Stuart,

While in Task Builder, from the Actions pane, type the word 'Task' to see the Activities under the Task action
Start subtask
Stop
Call function

 Category Survey


-------------------------

Valentineo McGowan | Technical Consultant
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1 213.738.6966 | F: +1.213.738.7665
 08/20/2015 02:19 AM
User is offline View Users Profile Print this message

Author Icon
StuartNelson
Student (5-19 posts)

Posts: 10
Joined: 08/07/2015

Sorry about the delay been doing other work and had to leave this.

I tried to upload screen shots to explain and show the difference.

The PC AutoMate 7 "Start Task" action has two options on the "General" tab, one is "Run A Task File", the other is "Start A Managed Task".

On BPA 9 the "Start Task" action only has the option "Task File To Start", I need an alternative for the "Start A Managed Task", I'm baffled by why it's absent

 

 

 

 



 Category Survey
AutoMate BPA Server 9 version: 9.0.4
Windows version: Windows Server 2003
 08/24/2015 11:23 AM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hi Stuart,


Since you are now running BPA, I would suggest you create a workflow to accomplish your request. If you already imported the task you can use the Repository tab within the WFD to drag and drop the task in question. You can then connect them using a success arrow.

Let us know if that helps you.

 Category Survey


-------------------------

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1862 guests browsing this forum, which makes a total of 1862 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog