I'm trying to understand working with objects that are containers of rows. Even that description may be incorrect.
What is "FilteredRows" in this context?
dt = Current Data Table();
FilteredRows = dt << get rows where( :Date == 12May2025 );
Show( N Rows( FilteredRows ) );
To back up slightly, is there a JSL command to set an object to ALL rows in a datatable? Or is that never necessary?
The closest I can find that avoids 'Select All Rows' is:
AllRows = dt << get rows where(1);
Feels like cheating though.
More importantly, I'd like to be able to apply additional filters to a subset of rows
This does not work, but conveys the intent:
XFilteredRows = dt << get rows where( :X == 42 );
XYFilteredRows = XFilteredRows << get rows where(:Y ==1.21);
Yes, I can do both in one line
XYFiteredRows = dt << get rows where(:X==42 & :Y==1.21);
However I plan to use this in a For Each Row loop, where X removes 99% of the rows, and I'll need to subsequently filter more parameters independently, i.e. rows that meet XY, and rows that meet XZ and rows that meet X but not Y, etc...
I believe it will be faster on large tables to keep the X filtered rows.
On a related note, one result I'm trying to get is very similar to the 'Group By' result, but with a custom formula.
JSL of a column formula:
Col Mean( :Parameter, :X )
'Group By' is very convenient for created column formula from built in functions, but when I want to do more complex math I don't know how to achieve the same grouping effect.
The "container" is a (1 dimensional) "matrix".
you can also create a matrix manually:
myRows= Matrix ({1,2,3})
myRows = 1::3
myRows = [1, 2, 3]
There are 2 ways to intersect (and other set operations like union, difference)
a) using associative arrays
aa1 = associative array (myRows1);
aa2 = associative array (myRows2);
aa1 << intersect(aa2);<BR />// aa1 << remove(aa2);
list of rows = aa1 << get keys;
rows= matrix(list of rows);

b) [new in JMP19]: using lists
list1 = as list (myRows1);
list2 = as list (myRows2);
<STRIKE>list of rows = set intersect(list1, list2);</STRIKE>
list of rows = set intersection(list1, list2);
//list of rows = set difference(list1, list2);
rows= matrix(list of rows);

Intersections for Matrices? I guess: no
hogi,
You've rescued me again. Thanks!
One clarification, I used your syntax
list of rows = set intersect(list1, list2);
initially and it turned blue so I thought it was okay, but odd that it didn't capitalize. Then I looked it up in scripting guide and realized it was "Set Intersection". Now I'm good to go. Cheers!