Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
evasmith
Level I

How do I concatenate subsets of tables? Seems simple but I'm stuck

I need to do four things for all files in a directory:

  1. Open a data table
  2. Add a column
  3. Take a subset of that data table
  4. 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);   
);

 

1 REPLY 1
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: How do I concatenate subsets of tables? Seems simple but I'm stuck

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));
-Jeff
Article Labels

    There are no labels assigned to this post.