Subscribe Bookmark RSS Feed

Filtering Databases (Exhausting Subsets)

Greetings,

I'll keep it real simple and easy, just a home run swing for the JMP gurus on the board!



I'm trying to write a JSL script where I click on a column, run the script, and a subset table is created for each of the values in the field. (The field can consist of either numbers or text).


Thanks!
8 REPLIES
XanGregg

Staff

Joined:

Jun 23, 2011

One idea is to make a summary table and then make a subset for each row in the summary table.

Awesome!!! This is fantastic.

Thank you so much!
Suppose I wanted to name the subset table after the value for which it is filtering. I've defined a new line of code in the 'for loop' that should get the r(th) row from the summary table, but it isn't working for some reason.

(I haven't figured out how to post code correctly, so I'll paste it in two parts, starting with defining the data tables, then the for loop:

dt = Current Data Table();
If( N Items( dt << Get Selected Columns() ) != 1,
Throw( "select a column first" )
);
dtsum = dt << Summary( Group( dt << Get Selected Columns() ) );
dt << Clear Column Selection();
I can't get the script to paste on here, but I added the line:

tt = dtsum<
XanGregg

Staff

Joined:

Jun 23, 2011

Use to escape JSL code.

You should be able to set the table name in the subset command, but I haven't tried it.

I kept adding a "!" to the --> at the end, so problem solved! :)


Here is my comprehensive code. I'm trying to name each subset data table after the value of the Rth row from the summary data table (dtsum). I tried using a variation of the code you recommended here yesterday, as well as today, and I just can't figure out how to establish the variable that grabs the value I'm subsetting the table for.

Thanks for the help!


Wendy_Murphrey

Joined:

Jun 23, 2011

Hello,

Another option is to use the Summarize command to create a list of unique values in the selected column. The For loop would loop through each item in the list and make a subset data table for each. Notice the Output Table Name argument demonstrates how to give the subset tables appropriate names.



HTH.
Wendy
Okay, I'm really excited for this...

I got it! This code works!!!

Thank you xan and WK for the contributions.