cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
djhanson
Level V

How to make JSL save empty CSV file?

Is there any way to make JSL save an empty CSV file (meaning only column headers present)?

I would expect JSL to save the CSV file with the 1 row of column headers (and no other rows).  But instead JSL errors out.

I'm using JMP 11.1.1.

Let me know if you know any solutions (other than reconstructing the file with concatenation strings and commas and saving). thanks, DJ

3 REPLIES 3
djhanson
Level V

Re: How to make JSL save empty CSV file?

What's also crazy about this is that Excel lets you save a blank CSV file and JMP itself allows you to load a blank CSV file.

You would think if JMP doesn't care about loading a blank CSV file why would it now allow saving a blank CSV file?  It's just one row of headers.

pmroz
Super User

Re: How to make JSL save empty CSV file?

You might have to bite the bullet and write out a text file of the column headers.  Not too hard:

dt = New Table( "Example Table", Add Rows( 0 ),

      New Column( "aaaaa", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) ),

      New Column( "bbbbb", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) ),

      New Column( "ccccc", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) ),

      New Column( "ddddd", Numeric, Continuous, Format( "Best", 12 ), Set Values( [] ) )

);

col_names = dt << get column names(string);

text2save = concat items(col_names, ",");

csvfile = "c:\temp\csv_example.csv";

save text file(csvfile, text2save);

Craige_Hales
Super User

Re: How to make JSL save empty CSV file?

Thanks!  JMP 13 will do it. 

Craige

Craige