Skip to content

setVariable problem

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.

setVariable problem

Post by BlackAngel73 »

Hi,
I'm experiencing a strange behavior in the DIRECTOR when I setVariable.

this is the example project.

Code: Select all

<project name="Test_Append" mainModule="Main" version="2.0" threadSafe="true">
	<description>Test della funzionalità di append dei file</description>
	<variable name="ListaFileOrigine" value="" />
	<variable name="Nr_FileOrigine" value="0" />
	<variable name="DateFile" value="" />
	<variable name="FileDestinazione" value="" />
	<variable name="ProcessedFileOrigine" value="" />

	<module name="Main">
		<if label="VerificaDataProcessamento" condition="${IsEmpty(DateFile)==true}" logLevel="debug">

			<setVariable label="SetDataProcesso" name="DateTime" value="${CurrentDate(&apos;yyMMdd&apos;)}" version="2.0" logLevel="verbose" />

		</if>
		<if label="VerificaNomeFileDestinazione" condition="${IsEmpty(FileDestinazione)}" logLevel="debug">

			<setVariable label="SetFileDestinazione" name="FileDestinazione" value="${Concat(&apos;MergedFile.D&apos;, DateFile,&apos;.txt&apos;)}" version="2.0" />

		</if>

		<createWorkspace version="1.0" />


		<sftp label="Sftp_Origine" resourceId="GoAny_acalcag" version="1.0" logLevel="debug">
			<cd label="SourceRemoteDir" dir="/home/acalcag/sAppend" />
			<mget sourceFiles="*[uno|due|tre]*" destinationDir="~" whenFileExists="overwrite" prefix="BaseFile." suffix="{DateFile}.txt" destinationFilesVariable="ListaFileOrigine" numFilesDownloadedVariable="Nr_FileOrigine" processedSourceFilesVariable="ProcessedFileOrigine" />
		</sftp>


		<print label="Print-Post-SFTP-get" version="1.0">
			<![CDATA[Sono stati trovati i seguenti ${Nr_FileOrigine} File \n 
${ListaFileOrigine}.
Sono stati scaricati i seguenti File \n
${ProcessedFileOrigine}]]>
		</print>


		<mergeFiles label="Merging" inputFilesVariable="${ListaFileOrigine}" outputFile="/opt/goanysvc/Linoma_Software/GoAnywhere/userdata/documents/administrator/Test/${FileDestinazione}" whenFileExists="overwrite" processedInputFilesVariable="ProcessedFileOrigine" version="1.0" />


		<print label="Print-Post-Merging" version="1.0">
			<![CDATA[Sono stati uniti i seguenti Files \n
${ProcessedFileOrigine}]]>
		</print>


		<deleteWorkspace version="1.0" />

	</module>

</project>
into log the DataTime variable is setted but when I use DateTime to set another variable (FileDestinazione) it is (DateTime) is empty

Code: Select all

5/16/14 4:47:17 PM            INFO      Entering if block labeled 'VerificaDataProcessamento' as the condition "${IsEmpty(DateFile)==true}" was met
5/16/14 4:47:17 PM            INFO      Executing task 'setVariable 2.0 (SetDataProcesso)'
5/16/14 4:47:17 PM            INFO      Variable 'DateTime' was created and set to '140516'.
5/16/14 4:47:17 PM            INFO      Finished task 'setVariable 2.0 (SetDataProcesso)'
5/16/14 4:47:17 PM            INFO      Finished if block labeled 'VerificaDataProcessamento'
5/16/14 4:47:17 PM            INFO      Entering if block labeled 'VerificaNomeFileDestinazione' as the condition "${IsEmpty(FileDestinazione)}" was met
5/16/14 4:47:17 PM            INFO      Executing task 'setVariable 2.0 (SetFileDestinazione)'
5/16/14 4:47:17 PM            WARN      Variable 'FileDestinazione' was replaced with 'MergedFile.D.txt'.
5/16/14 4:47:17 PM            INFO      Finished task 'setVariable 2.0 (SetFileDestinazione)'
does anyone have any advice for me?
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: setVariable problem

Post by Support_Rick »

From your example below, you are passing in DATEFILE as a parameter. You are checking to see if this parameter is empty, and if it is, you are creating a variable called DATETIME and setting the value to "yyMMdd".

In the next if statement, you are checking the 2nd parameter "FileDestinazione" to see if that value is empty. If it is, you are wanting to set the value to "MergedFile.D<DATEFILE>.txt".

I believe the issue you have here is mixed Variable names.

Change your Concat statement to "MergedFile.D<DATETIME>.txt" and I believe you'll get what you're looking for. Another option would be to change your Concat function to:

${ concat( 'MergedFile.D', CurrentDate( 'yyMMdd' ), '.txt' ) }

Try this change and let us know if it helps...
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

Re: setVariable problem

Post by BlackAngel73 »

I actually mistyped the name of the variable. thanks
Post Reply