Dynamic export filename

I’ve tried various options to create a dynamic filename when doing an export, but each time I end up with an invalid filename.

I would like to include a timestamp in the file name. I see {{timestamp}} is available, but I haven’t been able to include it in an expression successfully.

Does the file have to exist? This doesn’t seem likely for a dynamic filename.

I would be grateful for any suggestions.

Try.

/path/here/{{TIMESTAMP}}.csv

TIMESTAMP must be in capitals

Great. That worked - thanks @Hyperbytes.

Do you know how to get ‘:’ in the time part?
{{TIMESTAMP.formatDate(“yyyy-MM-dd hh-mm”)}} results in ‘2018-12-12 09-23.csv’
… but if change the time part to ‘hh:mm’, the minutes don’t appear (and nor does the file extension).

try please
{{TIMESTAMP.formatDate(“yyyy-MM-dd HH-mm”)}

Thanks @s.alpaslan - but that results in a ‘-’, not a ‘:’ too. Perhaps it’s a localisation or operating system issue.

did you try pipe ’ | ’ because maybe its not allowed

http://xahlee.info/mswin/allowed_chars_in_file_names.html

That doesn’t work either, but the problem is me, not Wappler or the formatting.

I was just looking at the timestamp format in the database and thought I would the same format for filenames - but this wasn’t a sensible idea. I wasn’t thinking about filenames - I would never use a ‘:’ in a filename (it’s not possible anyway - as you point out). I think ‘-’ will be fine. Thanks.

1 Like