Using dynamic file names in UniversalDataWriter

Hi,

I’ve a requirement to decide output file names dynamically like file name appended by current date-time. Is this possible with UniversalDataWriter? I went through a couple of related posts in the forum, but they were a little unclear to me.

Any help would be highly appreciated.

Thanks,
Sreehareesh

Hello Sreehareesh,

This goal can be achieved very easily using parameters.

1. Create new parameter TODAY with value `date2str(today(),“yyyy-MM-dd”)` (Note that I have used back quotes syntax allowing me to use CTL1 functions within parameters.)
2. Set File URL in UniversalDataWriter to ${DATAOUT_DIR}/output-${TODAY}.txt
3. The result file is in data-out directory and it is named output-2014-02-06.txt

Is this solution sufficient for you?

Kind regards,

Hi,

It makes perfect sense!
Now I’m able to get it worked with your solution.
Thanks a lot for your valuable help.

Thanks,
Sreehareesh

Hi,
I also would like to use the some solution, but wanted to have different date (ex: today+1 or today-1), I tried by using others date function to apply in your solution with value `date2str(dateAdd(today(),1,day),“yyyyMMdd”)` but failed, any suggestion?

Thanks,
Michael.

Hello Michael,

Please note that CTL1 has to be used in parameters. And in CTL1, the name of dateadd function is defined with lower case “a” as opposed to CTL2 where dateAdd is defined with upper case “A”. Change this one character and your expression should be ok.

Regards,

Hi,

It’s work perfectly fine now, thanks~

Michael.

hi guys,

i want to dynamically attach a id from a database or to my http file URL
can some body pls help

Hi,

I believe this question was answered as part of this thread. Or is there anything else you need to clarify?