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.
3 posts Page 1 of 1

AmosG

Posts: 4
Joined: Mon Nov 10, 2014 4:49 pm

Post by AmosG » Mon Nov 10, 2014 6:12 pm
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

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Nov 10, 2014 6:51 pm
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

Posts: 4
Joined: Mon Nov 10, 2014 4:49 pm

Post by AmosG » Tue Nov 11, 2014 11:10 am
Thanks Rick. That worked perfectly.
3 posts Page 1 of 1