cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
bzanos
Level III

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" );

 

1 ACCEPTED SOLUTION

Accepted Solutions
pauldeen
Level VI

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()

 

 

View solution in original post

3 REPLIES 3
jthi
Super User

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:

jthi_0-1630910170421.png

 

-Jarmo
pauldeen
Level VI

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()

 

 

bzanos
Level III

Re: Save File with Fil Name and date/month/year and time

thank you.

Recommended Articles