What 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( finished=1)
);
my win = mfi << createwindow;
while(not(finished), wait(1));
- 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)