Hi @WhiteCow2000 ,
I had a crack at this by taking the position where '1' appears, marking each of them with an increasing number, then copying the Fill > Replace Missing with Previous Value option that can be done manually in JMP. I added a window for you to select your column that is to be measured to make it more flexible.
Names Default To Here( 1 );
dt = current data Table ();
dt << Clear Column Selection();
//This will work to find the instance where the lowest number (1 in this case) appears in the row order, if the rows are sorted in any way then it will adapt to that so be careful.
//Window to select the column with repeats
nw = New Window( "Launch Dialog",
<<Modal,
V List Box( Align( "right" ),
H List Box(
Panel Box( "Select Columns",
//Filter for continuous data only
clb = Filter Col Selector( dt, All,<<continuous(1), <<ordinal(0), <<nominal(0))
),
Panel Box( "Pick Experiment Repeat Column",
Lineup Box( N Col( 2 ), Spacing( 5 ),
Button Box( "Columns",
clbY << Append( clb << Get Selected )
),
clbY = Col List Box(
"Numeric",
MinItems( 1 ),
MaxItems( 1 ),
nlines( 5 )
),
Button Box( "Remove",
clbY << Remove Selected
)
)
)
),
H List Box(
Button Box( "OK",
(
cols = clby << Get Items( "Column Reference" );
run;);
),
Button Box( "Cancel" )
)
)
);
//Expression that runs the steps to mark out the rows
run=expr(
//Add a column to track experiment number
dt<<new column("Experiment No","Character");
//Find the points where "1" appears in the selected column
val=dt<<Get rows where (cols == 1);
//Mark each instance where 1 appears with an iteration from 1, 2, 3....
For(i=1, i<(N items(val)+1), i++,
dt:Experiment No[(val[i])] = i;);
//JSL Version of 'Fill Replace missing values...' Example taken from https://community.jmp.com/t5/Discussions/Fill-empty-cells-with-last-valid-value/m-p/30782#U30782
For( i = 2, i <= N Rows( dt ), i++,
If( Is Missing( :Experiment No[i] ),
:Experiment No[i] = :Experiment No[i - 1]
)
);
);
The simple version of the script where you would type the exact column names in JSL is here:
Names Default To Here( 1 );
dt = current data Table ();
//This will work to find the instance where the lowest number (1 in this case) appears in the row order, if the rows are sorted in any way
//Window to select the column with repeats
//Add a column to track experiment number
dt<<new column("Experiment No","Character");
//Find the points where "1" appears
val=dt<<Get rows where (:Column 1 == 1);
For(i=1, i<(N items(val)+1), i++,
dt:Column 2[(val[i])] = i;);
//JSL Version of 'Fill Replace missing values...' Example taken from https://community.jmp.com/t5/Discussions/Fill-empty-cells-with-last-valid-value/m-p/30782#U30782
For( i = 2, i <= N Rows( dt ), i++,
If( Is Missing( :Experiment No[i] ),
:Experiment No[i] = :Experiment No[i - 1]
)
);
“All models are wrong, but some are useful”