Transfer File Set among projects
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
6 posts
Page 1 of 1
Is there a way to pass in FileSet Variable across projects.
Just like passing the normal Variables as Strings.
This sample is throwing an error on the Second project, which is treating the passed in variable as a String.
Just like passing the normal Variables as Strings.
This sample is throwing an error on the Second project, which is treating the passed in variable as a String.
Code: Select all
<project name="Print" mainModule="Main" version="2.0">
<module name="Main">
<createFileList fileListVariable="files" version="1.0">
<fileset dir="D:\Program Files\Linoma Software\GoAnywhere\userdata\projects\" recursive="true" />
</createFileList>
<callProject project="/playground/Print FileList" runInSameJob="true" version="1.0">
<variable name="fileList" value="${files}" />
</callProject>
</module>
</project>
Code: Select all
<project name="Print FileList" mainModule="Main" version="2.0">
<module name="Main">
<forEachLoop itemsVariable="${fileList}" currentItemVariable="currFile">
<print version="1.0">
<![CDATA[${currFile:name}]]>
</print>
</forEachLoop>
</module>
</project>
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
To make this happen, you will need to change your callProject to something like the following:
Assigning the FileList to a New Variable changes the type of the FileList to a String Var in the Child Project, thus giving you the error you received.
Code: Select all
That way, the child project inherits the FileList Variable-${files} and it will allow you to perform a ForEach across the ${files} variable list. <callProject project="/Projects/Print FileList" runInSameJob="true" inheritUserVariables="true" returnUserVariables="true" mode="interactive" version="1.0" />
Assigning the FileList to a New Variable changes the type of the FileList to a String Var in the Child Project, thus giving you the error you received.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Thank you Rick, I was able to get the inherit variables, The only problem with that was the naming conventions that needed to be followed across a number of projects.
My Reason for separating the second project into stand alone is to be able to reuse across a number of primary projects.
The same functionality is obtained using Monitors, which does pass on the File list as a parameters (Not sure, how it does it), Hence I was exploring for a similar functionality.
My Reason for separating the second project into stand alone is to be able to reuse across a number of primary projects.
The same functionality is obtained using Monitors, which does pass on the File list as a parameters (Not sure, how it does it), Hence I was exploring for a similar functionality.
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
What I normally do when I'm creating a "utility" Project (as you are doing in this case) is to prefix the vars needed within the Utility to something specific to that Utility. An abbreviation or something. Then, I know what I'm getting when I get there as well as remove the possibility of cross contamination with other projects.
Inside the Utility ForEach loop, use a FileList var like:
1. ${pfl_FileList}
2. ${prt.FileList}
Then, create the same FileList var inside your calling Project (or Monitor) using that same syntax.
*NOTE*
I always add a Parameter (Variable) to my "Utility" Project matching any value I pass into that Utility for testing and/or definition of what the variable is and where it comes from.
Something Like:
From the Monitor | Action Tab, you add variables that give you what you need to pass to the Project. In this instance, you would create the FileList from the Monitor, and make the FileList Variable Name as "pfl.FileList" or whatever you are looping through within your Utility. That way the FileList becomes available to you from any location.
Inside the Utility ForEach loop, use a FileList var like:
1. ${pfl_FileList}
2. ${prt.FileList}
Then, create the same FileList var inside your calling Project (or Monitor) using that same syntax.
*NOTE*
I always add a Parameter (Variable) to my "Utility" Project matching any value I pass into that Utility for testing and/or definition of what the variable is and where it comes from.
Something Like:
Code: Select all
Even if you're calling the project with a Monitor, Scheduled Job or Trigger (GAS).<project name="My Utility" mainModule="Main" version="2.0" logevel="silent" threadSafe="true">
<variable name="myU.JobDIR" value="I" description="(I)nbound (O)utbound " />
<variable name="myU.JobMODE" value="Q" description="(Q)A (D)ev (P)rod (S)taging" />
<variable name="myU.JobGROUPID" value=" " description="GroupID to process" />
From the Monitor | Action Tab, you add variables that give you what you need to pass to the Project. In this instance, you would create the FileList from the Monitor, and make the FileList Variable Name as "pfl.FileList" or whatever you are looping through within your Utility. That way the FileList becomes available to you from any location.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
Not at this time... just the inherit vars option.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
6 posts
Page 1 of 1