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.

Transfer File Set among projects

Postby smandadi » Thu Oct 24, 2013 8:31 pm

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.


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>
smandadi
 
Posts: 17
Joined: Mon Jun 14, 2010 3:58 pm

Re: Transfer File Set among projects

Postby Support_Rick » Fri Oct 25, 2013 8:52 am

To make this happen, you will need to change your callProject to something like the following:

Code: Select all
      <callProject project="/Projects/Print FileList" runInSameJob="true" inheritUserVariables="true" returnUserVariables="true" mode="interactive" version="1.0" />


That way, the child project inherits the FileList Variable-${files} and it will allow you to perform a ForEach across the ${files} variable list.

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
Sr. Product Specialist
(402) 944.4242
(800) 949-4696
Support_Rick
Support Specialist
 
Posts: 202
Joined: Tue Jul 17, 2012 2:12 pm

Re: Transfer File Set among projects

Postby smandadi » Fri Oct 25, 2013 1:20 pm

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.
smandadi
 
Posts: 17
Joined: Mon Jun 14, 2010 3:58 pm

Re: Transfer File Set among projects

Postby Support_Rick » Fri Oct 25, 2013 1:46 pm

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:

Code: Select all
<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" />


Even if you're calling the project with a Monitor, Scheduled Job or Trigger (GAS).

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
Sr. Product Specialist
(402) 944.4242
(800) 949-4696
Support_Rick
Support Specialist
 
Posts: 202
Joined: Tue Jul 17, 2012 2:12 pm

Re: Transfer File Set among projects

Postby smandadi » Fri Oct 25, 2013 2:20 pm

Thank you Rick. To close this discussion. Is there a way to clone or copy from one filelist to another.
smandadi
 
Posts: 17
Joined: Mon Jun 14, 2010 3:58 pm

Re: Transfer File Set among projects

Postby Support_Rick » Fri Oct 25, 2013 2:37 pm

Not at this time... just the inherit vars option.
Rick Elliott
Sr. Product Specialist
(402) 944.4242
(800) 949-4696
Support_Rick
Support Specialist
 
Posts: 202
Joined: Tue Jul 17, 2012 2:12 pm


Return to Community Forum

Who is online

Users browsing this forum: No registered users and 1 guest