Choose Language Hide Translation Bar
Highlighted
caseofmondays
Level II

Force column from CSV import as Character not Numeric Date

Hello,

 

My input CSV data files have a Character column in the format of: "##.##.##".

"##" can be anything from 0 to 99.

 

The issue that I am having is that for most of these combinations, when I import the CSV using a basic "Open(filename)" command, the column converts it to a numeric date type which is not useful for me.

 

I have made patch fixes using Month/Day/Year column functions but I was interested in forcing the input to be a Character.

 

A colleague shared the following, which does exactly what I need for local CSV files.

The "Set Date Enable (0)" does exactly what I need.

 

dt = Multiple File Import(
   << Set Folder( csv_file_path ),
   << Set Name Filter( csv_filename ),
   << Set Date Enable( 0 )
) << Import Data;	

My current issue is that I also have CSV files that I download from a URL (not a local file) and I am not sure how to configure the above JSL code to get that to work.

 

URL CSV syntax: "http://xxx.yyy.com:###/api/csv.php?p=#####"

 

Any help is much appreciated.

 

1 REPLY 1
Highlighted
phil_kay
Staff

Re: Force column from CSV import as Character not Numeric Date

Hi,

 

I think this discussion will be helpful for you to understand more about the syntax for Multiple File Import(): How can I prevent 3-digit version numbers from getting read as dates into data table? 

 

I think that you will find that it is not the Set Date Enable argument that is enabling the correct import of your character data column. Rather, it is because the Import Multiple Files platform inherently will not try to guess date formats. Set Date Enable is determining whether or not the date filter is turned on (so that you could filter on a date range).

 

See here for more on the arguments: https://www.jmp.com/support/help/en/15.1/#page/jmp/utility-functions.shtml#ww7168938

 

That does not really answer your question but I hope it helps.

 

Regarding your question: are you using JSL because this is an action that you need to repeat or could you just use the point-and-click interface in JMP? I would think it would be worth experimenting with using the point-and-click interface to Import Multiple Files to get a better understanding of your problem.

 

Phil 

Article Labels

    There are no labels assigned to this post.