I am trying to correct previous "sins" in a script I wrote by updating it with unambiguous references, so that the script refers to the one table I (want to) tell it to, even though another table may be the current (or an "interfering") table. I've tried to reconstruct the problem below.
Names Default To Here( 1 );
// this is the table i want to work with
dt = New Table( "Target table", invisible,
Add Rows( 3 ),
New Column( "Name_1",
Character( 1 ),
"Nominal",
Set Values( {"A", "B", "C"} ),
Set Display Width( 45 )
),
New Column( "Name_2",
Character( 1 ),
"Nominal",
Set Values( {"X", "Y", "Z"} ),
Set Display Width( 45 )
),
New Column( "NumericRight",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 3] ),
Set Display Width( 78 )
),
New Column( "NumericAlso",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [7, 8, 9] )
)
);
dt2 = New Table( "Interfering table", invisible,
Add Rows( 3 ),
New Column( "Name_1",
Character( 1 ),
"Nominal",
Set Values( {"D", "E", "F"} ),
Set Display Width( 45 )
),
New Column( "Name_2",
Character( 1 ),
"Nominal",
Set Values( {"U", "V", "W"} ),
Set Display Width( 45 )
),
New Column( "NumericInterference",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [4, 5, 6] )
),
New Column( "MoreNumeric",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [7, 8, 9] )
)
);
// get lists
lstName_1 = Associative Array( dt:Name_1 ) << Get Keys;
lstName_2 = Associative Array( dt:Name_2 ) << Get Keys;
colList = dt << Get Column Names( "Numeric" );
// window with radio buttons & col list box
New Window( "Select values",
Show Menu( 0 ),
Show Toolbars( 0 ),
Border Box( Top( 0 ), Bottom( 20 ), Left( 20 ), Right( 10 ),
H List Box(
Panel Box( "Name_1",
Radio Box(
Eval List( lstName_1 )
)
),
Panel Box( "Name_2",
Radio Box(
Eval List( lstName_2 )
)
),
Panel Box( "Numeric Columns",
clb = Col List Box( )
),
clb << Append( colList ); // making me cry ...
)
)
);
What I want to see:
What I invariably see if my "target table" is not the current table:
What completely confuses me is that when I change the name of dt2:NumericInterference to dt2:NumericRight, I get this result:
Why is dt2 not letting my script do the work I want it to do? Why is the name change of a column in dt2 affecting what gets into the column list box? I've tried a few variations of moving the colList variable and also tried wrapping it into Eval List(), without "luck".
Searching again in the community I found this Need help with populating Col List Box. If there's another solution, thanks for letting me know. Alternatively, is this how it is meant to be, and if so, what is the meaning of this?