- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Save File with Fil Name and date/month/year and time
Hi, everyone, i am trying to save file with file name date/month/year and time. Below is my code. But it cannot save the file. I do not see the file in the directory. I see this error "Cannot expand path expression: $TEMP-big class_09-06-2021 2-02-16 PM.jmp". Anything wrong with my code? How to fix it?
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt << Save( "$TEMP/" || Char( dt << get name )||"_"||MDYHMS( Today() )||".jmp" );
dt << Save ( "$TEMP/" || Char( dt << get name )||"_"||Format Date( Today(), "ddmonyyyy h:m" )||".jmp" );
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save File with Fil Name and date/month/year and time
It seems like your local date format uses / as the seperator and that is not allowed in file names. Throw in a substitute to replace "/" with "-".
regex(format(timestamp,"yyyy-mm-ddThh:mm:ss"),"[-:]",".",GLOBALREPLACE)
timestamp can be today()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save File with Fil Name and date/month/year and time
Not sure what that error message means, but I would suggest printing the possible paths you are trying to save to and check if there are some forbidden character you are trying use as the file name:
Names Default To Here(1);dt = Open("$SAMPLE_DATA/big class.jmp");
path1 = "$TEMP/" || Char( dt << get name )||"_"||MDYHMS( Today() )||".jmp";
path2 = "$TEMP/" || Char(dt << get name) || "_" || Format Date(Today(), "ddmonyyyy h:m") || ".jmp";
Show(path1, path2);
For windows:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save File with Fil Name and date/month/year and time
It seems like your local date format uses / as the seperator and that is not allowed in file names. Throw in a substitute to replace "/" with "-".
regex(format(timestamp,"yyyy-mm-ddThh:mm:ss"),"[-:]",".",GLOBALREPLACE)
timestamp can be today()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Save File with Fil Name and date/month/year and time
thank you.