Page 1 of 1

Populating a Variable using other variables and a function

Posted: Mon Nov 10, 2014 6:12 pm
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.

Re: Populating a Variable using other variables and a functi

Posted: Mon Nov 10, 2014 6:51 pm
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

Re: Populating a Variable using other variables and a functi

Posted: Tue Nov 11, 2014 11:10 am
by AmosG
Thanks Rick. That worked perfectly.