cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

Add File Name and Date in Import Settings

I would like some input on how to include adding File Name and File Date in import settings. 

In typical Multiple File Import, we have 

<<Set Add File Name Column( 1 ),
<<Set Add File Size Column( 0 ),
<<Set Add File Date Column( 1 ),
However, this will not work in my case. So I tried using New Column () function, but it gives empty columns or no column "Source File" at all.
 
 For(i = 1, i <= N Items(selectedPaths), i++,
        path = selectedPaths[i];
        dt = Open(
            path,
            Headers(1),
            Column Names Start(1),
            Data Starts(2),
            End Of Field(","),
            Invisible
        );

        dt << New Column("Source File",
            Character,
            Set Values(Repeat(path, N Rows(dt)))
        );
I guess it should be included amongst dt = Open () setting but I do not know what to put there for File Name and File Date Columns. 
2 REPLIES 2
jthi
Super User

Re: Add File Name and Date in Import Settings

Is there a specific reason why Multiple File Import cannot be used? You can find syntax for Open() from JSL Syntax reference Open(path, <arguments>) or from scripting guide but I would suggest you do it once manually from JMP using the interactive open and then copy+modify the script JMP provides you with.

-Jarmo
txnelson
Super User

Re: Add File Name and Date in Import Settings

A couple of comments

Using your JSL, you can change your code very simply to add in the Path

dt << New Column("Source File",
            Character,
            Set Each Value(path)
        );

Also, if you use the Modal option on your New Windows you do not have to use your "Done" methodology.  Modal windows stop the processing beyond the New Window, until the window is closed

Names Default To Here(1);

// Step 1: Prompt user to choose between File or Folder
uploadType = "";
done = 0;

nw = New Window("Select Upload Type",modal,
    Panel Box("Choose Upload Type",
        cb = Combo Box({"File", "Folder"}),
        Button Box("OK",
            uploadType = cb << Get Selected;;
        )
    )
);
Jim

Recommended Articles