Skip to content

Populating a Variable using other variables and a function

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • AmosG Offline
  • Posts: 4
  • Joined: Mon Nov 10, 2014 4:49 pm

Populating a Variable using other variables and a function

Post by AmosG »

I am trying to create a list of files that have been processed to be included in an email when the process is complete. The logic to populate the variable is within a loop.

I am expecting- TEST22.txt, TEST23.txt, TEST24.txt, TEST25.txt

This is the code that I have but it is not producing the desired results.

<setVariable label="Populate ListofFiles Variable" name="ListofFiles" value="Concat(${ListofFiles}, ${Currentfile:name})" version="2.0" logLevel="debug" />

The above code is producing the following

Concat(Concat(Concat(Concat(TEST22.txt, TEST23.txt), TEST24.txt), TEST25.txt)

Thank you for your assistance.
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Populating a Variable using other variables and a functi

Post by Support_Rick »

Amos,

Try something like this:

Code: Select all

<setVariable label="Set:  ListOfFiles" name="ListOfFiles" value="${system.emptyString}" version="2.0" logLevel="silent" />

<forEachLoop label="Get ListOfFiles" itemsVariable="${MyFileList}" currentItemVariable="MyFile">

	<setVariable label="Update:  ListOfFiles" name="ListOfFiles" value="${Concat( ListOfFiles, MyFile:name, system.carriageReturn ) }" version="2.0" logLevel="silent" />

</forEachLoop>

<print label="(Status) Print List" version="1.0">
	<![CDATA[
==========================
${ListOfFiles}
==========================]]>
</print>
**NOTE** This assumes you are on GAD Version 4.0+ and have upgraded your Project to Version 2.0
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • AmosG Offline
  • Posts: 4
  • Joined: Mon Nov 10, 2014 4:49 pm

Re: Populating a Variable using other variables and a functi

Post by AmosG »

Thanks Rick. That worked perfectly.
Post Reply