All,
I am trying to open files in a folder by searching characters of file name based on user input.
/* Input values in 3 columns by user. eg of file name: ABC_12_XYZ. User will input ABC in 1st column, 12 in second col and XYZ in 3rd column. all three should match in a row for selecting the file. There could be 100's of files (unique name) in the folder. User will input all that he wants to select from folder into input file. The file name search is limited to 10 characters from beginning of file name. The code is getting stuck somewhere in loop*/
//Script ------
Retrieve = Open( "C:\*\inputfile.jmp" );
x = Column( Retrieve, "Col1" ) << Get Values;
y = Column( Retrieve, "Col2" ) << Get Values;
z = Column( Retrieve, "Col3" ) << Get Values;
// location of files which needs to be read from a folder based on user inputs.
Set Default Directory("C:\test\");
Close( Retrieve, NoSave );
Col1_search = 1;
Col2_search = 1;
Count = 0;
For( i = 1, i <= N Items( files ), i++,
For( j = 1, j <= N Items( z ), j++,
If( Contains( files[i], z[j] ),
If( Col1_search == 1,
If( (Contains( files[i], z[j] ) & Contains( Left( files[i], 10 ), x[j] )) > 0,
If( Col2_Search == 1,
If(
((Contains( files[i], z[j] ) & Contains( Left( files[i], 10 ), x[j] )) > 0) & (Contains( Left( files[i], 10 ), y[j] ) > (Contains( Left( files[i], 10 ), x[j] ))),
Open( files[i] );
Count++;
),
Open( files[i] );
If( Count == N Items( z ),
Break();
);
)
)
),
Open( files[i] )
)
);
);
openDTs = {};