Multifile Import in a script / workflowWhat is the best way to use Multi File Import in a script?
[I want to give the user the chance to edit the settings and then click on Import.]
My current approach:
- Pause the script till the import is ready:
- use a while loop
- stop it via Set Import Callback
finished= 0;
mfi = Multiple File Import(
<<SET import="" callback=""></SET>
- get a list of the imported data tables:
via _wfb_Listdiff() (from Workflow Builder):
_wfb_ListDiff = Function( {tempOld, tempNew},
For( i = 1, i <= N Items( tempOld ), i++,
For( k = N Items( tempNew ), k >= 1, k--,
If( tempOld[i] == tempNew[k],
Remove From( tempNew, k, 1 )
)
)
);
tempNew;
);
Custom_step_tables_old = Get Data Table List();
MFI();
while(no(finished), wait());
Custom_step_tables_new = Get Data Table List();
dts = _wfb_ListDiff( Custom_step_tables_old, Custom_step_tables_new );
- if there is no data ..
To stop the execution of subsequent code, check
if (items(dts) ==0, Throw("no data"));
did you know that stop() inside a Workflow step just stops the execution of the current step?
so: Throw().
-
The user can close the MFI dialog via

then the while loop will run forever (or: till the user presses ESC)
-> add an on close script:
my win = mfi << createwindow;
wait(0);
current window() << on close(finished=1)
Automation and ScriptingRe: Multifile Import in a script / workflowYou should be able to get the list of imported tables from the callback function, look at the SetImportCallback example.
If JSL does the <
Re: Multifile Import in a script / workflowhi @Craige_Hales
As an alternative, I changed the behavior of the Import button:
my win[ButtonBox(8)] << set function (dts = mfi << Import Data(); wait(0); finished=1);
But, unfortunately, the original import is triggered as well.
... so I replaced the import button with an alternative one:
my win = mfi << createwindow;
my win[ButtonBox(8)] << sib append (Button Box ("Import +",dts = mfi << Import Data(); wait(0); my win << close window()));<BR />my win[ButtonBox(8)] << delete
What example are you referring to, I couldn't find it.
Re: Multifile Import in a script / workflowMake sure the category selector shows objects (or all.)

Re: Multifile Import in a script / workflow: )