Page 1 of 1

Trying to create a file variable to create a checksum

Posted: Thu Jan 10, 2019 12:22 pm
by FNova
I've been learning as I go with GA, and am trying to figure out the steps here:

I've got a folder where there is a new file every 4 hours. The naming convention is:
yyyyMMddhhmm_Widget_.xz

Basically, I just need to figure out how to pull the latest file (I tried setting timestamp variables, but I haven't gotten it to work), but once I can set a variable for the filename, I can create a checksum file that is basically ${latestfile}.md5, which I can then print into the directory where the file is located.

I looked through the forum, as I'm guessing this is pretty rudimentary, but couldn't find a solution?

Can someone please assist?

Thanks!

Re: Trying to create a file variable to create a checksum

Posted: Mon Apr 22, 2019 2:52 pm
by Support_Julie
On your date manipulation, it should be just -3, not ${-3}
Also, when you reference your variables on the Create File List, always assume that case matters.
Your variable is defined as Minus3, but you are referencing it in the data filter as ${minus3}

Since you are looking at the time, I would add that to the date format.

Your Project XML:
Code: Select all
		
		<timestamp label="Set Minus3" version="1.0">
			<format outputVariable="Minus3" pattern="yyyy-MM-dd" hour="${-3}" />
		</timestamp>


		<timestamp label="Set Minus5" version="1.0">
			<format outputVariable="Minus5" pattern="yyyy-MM-dd" hour="${-5}" />
		</timestamp>


		<createFileList label="Create LatestFile" fileListVariable="LatestFile" version="1.0">
			<fileset dir="resource:s3://fpq-s3-tc-vessel-prd/staging/TradeCompliance/staging" recursive="false" sortedBy="last modified" sortOrder="descending">
				<dateFilter>
					<include from="${minus3}" to="${minus5}" />
				</dateFilter>
			</fileset>
		</createFileList>
		
Suggested Project XML:
Code: Select all
<timestamp _tmplitem="30"  label="Set Minus3" version="1.0">
			<format _tmplitem="30"  outputVariable="Minus3" pattern="yyyy-MM-dd HH:mm:ss" hour="-3" ></format>
		</timestamp>


		<timestamp _tmplitem="30"  label="Set Minus5" version="1.0">
			<format _tmplitem="30"  outputVariable="Minus5" pattern="yyyy-MM-dd HH:mm:ss" hour="-5" ></format>
		</timestamp>