Hi,
I really would avoid a construction like this. Looking at the formula in that table you can see that there is a problem. You run into scoping problems (using a list defined outside in a formula), and you try to write the column itself within the formula in the column. Didn't know that JMP would let us ...
However I can reproduce your problem, but not exactly explain why.
So my proposal would be to loop outside like shown in the script below, it's much more transparent.
The loc() function gives you the position (index) in the list.
Another way would be to generate a table from your ID_LIST and Vessel_LIST,
and join that table to the table with reference dt.
Names Default To Here( 1 );
ID_List = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24",
"25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48"};
Vessel_List = {"CS1-1", "CS1-2", "CS1-3", "CS1-4", "CS1-5", "CS1-6", "CS1-7", "CS1-8", "CS1-9", "CS1-10", "CS1-11", "CS1-12", "CS2-1", "CS2-2",
"CS2-3", "CS2-4", "CS2-5", "CS2-6", "CS2-7", "CS2-8", "CS2-9", "CS2-10", "CS2-11", "CS2-12", "CS3-1", "CS3-2", "CS3-3", "CS3-4", "CS3-5", "CS3-6",
"CS3-7", "CS3-8", "CS3-9", "CS3-10", "CS3-11", "CS3-12", "CS4-1", "CS4-2", "CS4-3", "CS4-4", "CS4-5", "CS4-6", "CS4-7", "CS4-8", "CS4-9", "CS4-10",
"CS4-11", "CS4-12"};
Show( N Items( ID_LIST ) );
Show( N Items( Vessel_LIST ) );
dt = New Table( "test", add rows( 48 ), New Column( "Vessel ID ViCell", Character, Nominal, set values( Vessel_list ) ) );
N = N Rows( dt );
dt << New Column( "row", "Numeric", "Continuous", Formula( For( i = 1, i <= N, i++, Column( dt, "row" )[i] = i ) ) );
dt << New Column( "Vessel NB",
"Numeric",
"Continuous",
Formula(
For( i = 1, i < N + 1, i++,
r = dt << getRowsWhere( :Vessel ID ViCell == Vessel_List[i] );
Column( dt, "Vessel NB" )[r] = ID_List[i];
)
)
);
// My proposal: run the loop outside, as the lists are outside, too
dt << New Column( "Vessel NB 2", "Numeric", "Continuous" );
For Each Row( dt, :Vessel NB 2 = ID_LIST[Loc( Vessel_LIST, :Vessel ID ViCell )[1]] );
Georg