Page 1 of 1

adding a date to the name of an output file

Posted: Fri Mar 15, 2013 11:06 am
by mark_a_hall
Is there an easy way to add the date to the name of an output file. I am pulling data from the IBM i and writing it to the ifs as a CSV file (also ftp'ing it somewhere else).

Re: adding a date to the name of an output file

Posted: Fri Mar 15, 2013 1:19 pm
by Support_Rick
Mark,

There are several ways to do this ... try something like this:
Code: Select all
<project name="Date Test" mainModule="Main" version="2.0">
	<module name="Main">

		<createWorkspace version="1.0" />

		<timestamp version="1.0">
			<format outputVariable="DateStamp" pattern="yyyyMMdd.HHmmss" />
		</timestamp>

<!-- Need to create the SQL Rowset of Data "MyRowset" here -->

		<writeCSV label="Create CSV File" inputRowSetVariable="${MyRowset}" outputFile="MyFile.csv.${DateStamp}" whenFileExists="overwrite" outputFileVariable="MyCSVFile" version="1.0" />

		<sftp label="Connect to Server" resourceId="Test SFTP" version="1.0">
			<put label="Push CSV File to Server" sourceFilesVariable="${MyCSVFile}" destinationDir="/" />
		</sftp>

		<deleteWorkspace version="1.0" />

	</module>
</project>