|
|
How to dynamically create filenames w/date/time stamps.
I poked around a for a way to include a time stamp in the filename of a
export, and didn't find a clear answer that didn't involve buying a
plugin. Evenutally I figured it out, here is how I did if anyone wants
to know.
short
Basically I used a bunch of unstored calculation fields to grab the
different parts a date/time stamp. Then used the Set Variable script
step to meld them into a filename.
longer
First create un-stored, calculation fields, (result is text) for the
parts of a time stamp you want to use. Use Time and Date functions in
conjunction with Get functions to grab the different pieces of your
date/time stamp. For example:
vDay =Day(Get(Currentdate))
vMonth =MonthName (Get(Currentdate))
vHour =Hour(Get(CurrentTime))
vMinute...
vSecond...
vYear... you get the idea.
Now use the Set Variable script step to weld all the pieces of your
timestamp together like this:
Set Variable $datehr = vDay & "-" & vMonth & "-"& vHour &
".csv" (keep in mind these fields will have to be on the active
layout when this script step runs.)
Assume it is: 9/26/1971 3:24pm
The $datehr variable should = 26-9-15.csv (month, day, hour)
Now use $datehr as the filename when you export your file.
Experiment, test, fiddle... bake until golden brown.
McJoe
|
|
0
|
|
|
|
Reply
|
joseph.sanders (8)
|
4/17/2006 10:02:00 PM |
|
If you don't want to add a bunch of fields to your database (and layouts),
and need the various date values only for timestamping, you can express it
all with a single "Set Variable" command:
Let ( d=Get ( CurrentTimeStamp ) ;
Right(Year(d),2) &
Right("00" & Month(d),2 ) &
Right("00" & Day(d),2 ) & "-" &
Right("00" & Hour(d),2 ) &
Right("00" & Minute(d),2 ) &
Right("00" & Seconds(d),2 )
)
Yields timestamps in my preferred format. (Sorts by alpha very nicely.) Or
in your format it would be:
Let ( d=Get ( CurrentTimeStamp ) ;
Day(d) & "-" &
Month(d) & "-" &
Hour(d) & ".csv"
)
|
|
0
|
|
|
|
Reply
|
Bill
|
4/17/2006 11:42:22 PM
|
|
Cool
|
|
0
|
|
|
|
Reply
|
Joe
|
4/18/2006 9:27:22 PM
|
|
|
2 Replies
626 Views
(page loaded in 2.083 seconds)
|
|
|
|
|
|
|
|
|