cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

As the tile says - I have tried the following but does not work

Names Default To Here( 1 );
// use the save-script-to-script-window button 
// in the MFI dialog to see more messages
// for filtering files and controlling the import
Multiple File Import( Keep Dialog Open (0),
	<<Set Folder( "$DESKTOP" ),
	<<Set Name Filter( "*.csv;" ),
	<<Set Name Enable( 1 )
) << Create Window;

Where am I going wrong?

When it's too good to be true, it's neither
17 REPLIES 17
Neo
Neo
Level VI

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

@jthi Thanks, but as I have indicated above (posted incorrect code first which I have edited now), how does one include scripts inside On Close() which call on one of more of the imported data tables?

When it's too good to be true, it's neither
jthi
Super User

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

You would loop over your list of data tables and perform the actions. Depending on what you are doing you could build expressions or functions which could then be called inside the loop.

-Jarmo
Neo
Neo
Level VI

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

@jthi Ok I will try to loop, but where does the loop go - inside On Close () or outside On Close (). Also what does the attached error message mean?

When it's too good to be true, it's neither
jthi
Super User

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

Whatever you want to happen after Multiple File Import has been closed, should happen inside On Close. You can make it a bit cleaner by creating functions and expressions outside the On close but then call them inside.

 

It might be a good idea to accept solution to this post as it has already been solved and post a new one with additional information on what you wish to do after.

-Jarmo
txnelson
Super User

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

I ran Jarmo's code on JMP 16.2 on Windows 11 and it ran correctly.  I was able to set the Keep Dialog Open checkbox to off or on using

checkboxes = (mfi << XPath("//CheckBoxBox")); 
checkboxes[N Items(checkboxes)] << Set(0);

or

checkboxes = (mfi << XPath("//CheckBoxBox")); 
checkboxes[N Items(checkboxes)] << Set(1);

 

Jim
Craige_Hales
Super User

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

Example for the Import Callback script

x=Multiple File Import(
	<<Set Folder( "C:\Users\v1\Documents\" ),
	<<Set Name Filter( "*.csv; *.txt; " ),
	<<Set Name Enable( 1 ),
	<<Set Import Callback( function({mfi,list},show(list, mfi<<GetFolder);x<<closewindow) )
) << createwindow;

This script runs when the import button finishes; you might need the list of data tables.

You might send MFI a command to <<get a parameter the user specified.

x<<closewindow will force the window to close, ignoring the check box.

 

Extra info:

<<createwindow starts the mfi platform interactively with the setup provided; the <<CreateWindow message puts the created window in the X variable. If you use the <<ImportData message instead, x will hold the data table list. If you don't use a message, x will hold the scriptable platform, which you can send messages like <<SetFolder and <<CreateWindow to.

 

The setup messages are inside the parens for the mfi launch and happen before the window opens; the launch returns an MFI object which the CreateWindow message is sent to; the result from CreateWindow is assigned to x.

 

Craige
jthi
Super User

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

Nice info @Craige_Hales !

Scripting index (or rather JMP/JSL documentation) strikes again

jthi_0-1684994302153.png

 

-Jarmo
Craige_Hales
Super User

Re: How to start Multiple File Import () vis JSL with Keep Dialog Open unchecked?

My fault, I'm afraid. I already sent a note to the technical team. It was added after the initial release, for exactly this purpose.
Craige