How to make script run for each sample in a list if there are multiple entries per sample in data table.I have a data table where the same samples were measured multiple times (see example below). The samples are separated by their identifier.

I want my script to be able to perform the same set of calculations on each sample so I can determine control limits and make a control chart for A, B, C, etc. I do not know the identifier of each sample. I already have a script that can do my calculations and make the charts for me, it just cannot do separate calculations for each identifier.
My initial through was to use some kind of loop to do this. I have a script that returns each unique identifier in a list and gives me the number of unique identifiers as a set up for the loop.
Identifiers = Column( "Identifier") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
I just can't seem to get a loop to work though. Is there a better way to do this? Or could someone show me how to do the loop?
I am using JMP 10.
Thank you!
ScriptingRe: How to make script run for each sample in a list if there are multiple entries per sample in data table.There are lots of ways to do this, but one is to just add a local data filter to your existing platforms. Here is an example using graph builder:
Names default to here(1);
//Open some sample data
dt = Open( "$Sample_data/big class.jmp" );
//Your code
Identifiers = Column( "age") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
//A window to hold a bunch of graphs
win = New Window("Graphs", graphbox = v list box());
//Open a graph that is filtered to only show each unique identifier
//to keep things organized add it to a single window.
for( i=1, i<=nUnique Identifiers, i++,
win << Append(<BR /> //To get this script I opened graph builder and added a local data filter for one age<BR /> //and then copied/pasted it here and replaced the age with 4Unique Identifiers[i]
Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Close Outline( 1 ),
Add Filter(
columns( :age ),
Where( :age == Unique Identifiers[i] ),
Display( :age, N Items( 6 ) )
)
)
)
)
);Re: How to make script run for each sample in a list if there are multiple entries per sample in data table.I wonder if using the built-in control chart platforms to calculate limits and plot measures would work, especially if you assign Identifier to the By analysis role.
Just don't want you to spend a lot of time scripting if it duplicates what functionality is already available.