Your formula should not contain a For() loop, unless you are running this not as a JMP formula, but rather as JSL in open code. If you specify the code as being a formula for the column, JMP automatically loops through each row of the data, and applies the formula. Thus, the For() loop is not required Below is a little script that creates a new column and then adds a formula for the column.
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "The New Column",
formula( If( :ATT1 == 0, 0, Abs( :RESULT - :RESULT[Row() + 3] ) ) )
);
If you have an empty column(for example, called "mytest") you can use a For Each Row() function to loop through the data table and calculate values
Names Default To Here( 1 );
dt = Current Data Table();
For Each Row(
If( :ATT1 == 0,
:mytest = 0,
:mytest = Abs( :RESULT - :RESULT[Row() + 3] )
)
);
Finally, as you have indicated, you can use a For() loop to loop through the data table. This code requires that one specifies the specific row to operate on
Names Default To Here( 1 );
dt = Current Data Table();
For( i=1, i<=N Rows(dt), i++,
If( :ATT1[i] == 0,
:mytest[i] = 0,
:mytest[i] = Abs( :RESULT[i] - :RESULT[i + 3] )
)
);
Jim