Using associative array to store the value and then increase as needed should work here.
Formula for Required Column 1:
As Constant(
aa = Associative Array(:Client_ID);
aa = Associative Array(aa << get keys, Repeat(0, N Items(aa)));
retval = 1;
);
If(:Client_ID != Lag(:Client_ID),
aa[:Client_ID]++;
);
aa[:Client_ID];
And Final Requirement:
Eval Insert("^:Client_ID^_^:Required Column 2^");
Example script (uses different column names):
Names Default To Here(1);
dt = Open("$DOWNLOADS/data.jmp");
dt << New Column("Required Column 2", Numeric, Ordinal, Formula(
As Constant(
aa = Associative Array(:Client_ID);
aa = Associative Array(aa << get keys, Repeat(0, N Items(aa)));
retval = 1;
);
If(:Client_ID != Lag(:Client_ID),
aa[:Client_ID]++;
);
aa[:Client_ID];
));
dt << New Column("Final Requirement 2", Character, Ordinal, Formula(
Eval Insert("^:Client_ID^_^:Required Column 2^");
));
-Jarmo