setVariable problem
- Posts: 2
- Joined: Fri May 16, 2014 9:39 am
I'm experiencing a strange behavior in the DIRECTOR when I setVariable.
this is the example project.
<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('yyMMdd')}" version="2.0" logLevel="verbose" />
</if>
<if label="VerificaNomeFileDestinazione" condition="${IsEmpty(FileDestinazione)}" logLevel="debug">
<setVariable label="SetFileDestinazione" name="FileDestinazione" value="${Concat('MergedFile.D', DateFile,'.txt')}" 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>
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)'
- Support Specialist
- Posts: 592
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
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...
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
- Posts: 2
- Joined: Fri May 16, 2014 9:39 am