I need to do four things for all files in a directory:
- Open a data table
- Add a column
- Take a subset of that data table
- Concatenate that subset onto a different table
Seems so simple, but I get stuck on step 4. I can concatenate the original data table into the different table, but not the subset. How do I get jmp to work with this subset?
Each file is large enough that I need to take the subset before the concatenation operation. Concatenating all the whole original files leads to jmp crashing. I need to do this every week, so I am hoping for a script to do this.
Here's what I have.
Directory="C:\testpath\testdir\";
FileNames=Files in Directory (Directory);
Summary=New Table("Summary");
For (iFile=1, iFile<=N Items (FileNames), iFile++,
FileString=File Names[iFile];
File_Path=ConCat(Directory,FileString,"\",FileString,".jmp");
One Day Table=Open(File_Path);
New Column("Count Number",Character,Nominal,Formula(Right(:WaferId,2)));
One Day Table << Select Where((Count Number=="01" | Count Number=="08" | Count Number=="15" | Count Number=="22")& Is Missing(Name("SWR::WaferData::SWRNoLEHI1")));
One Day Table Part=One Day Table << Subset (Selected Rows);
FinalTable = Summary << Concatenate(One Day Table Part,OutputTable("Table C"));
close(One Day Table,No Save);
);
I'm not sure exactly what you're saying your problem is but I do notice that you're concatenating to the "Summary" table and creating a new data each time. If you're trying to accumulate the parts into a single data table you'll need to concatenate to that table each time. You can do that with the Append to First Table(1) option on the Concatenate message.
Summary = New Table( "Summary" );
One Day Table = Open( "$SAMPLE_DATA\Big Class.jmp" );
One Day Table << Select Where( (:Sex == "M") );
One Day Table Part = One Day Table << Subset( Selected Rows );
Summary << Concatenate( One Day Table Part, append to first table(1));
Another Day Table = Open("$SAMPLE_DATA\Fitness.jmp");
Another Day Table << Select Where( (:Sex == "M") );
Another Day Table Part = Another Day Table << Subset( Selected Rows );
Summary << Concatenate( Another Day Table Part, append to first table(1));