Thanks PMroz, the window is indeed useful. Everything is smooth except for the New Column portion.
I'm not sure what I did wrongly but the eval insert sentence is still not working although the expression in the log looks fine to me :/
masterdt = New Table( "Master DT", Add Rows( 5 ),
New Column( "XX01", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [1, 2, ., 3, 4] )
),
New Column( "XX02", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [., 1, 2, ., .] )
),
New Column( "XX03", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [., ., 1, 2, 3] )
),
New Column( "LOT_SORTED_DIES", Numeric, Continuous, Format( "Best", 12 ),
Set Values( [10, 10, 10, 20, 30] )
)
);
popup = New Window( "Summary Table", <<modal(),
Text Box( "Enter Softbin XX:"),
H List Box(
Text Box( "Softbin ID: " ),
Soft_Bin = Number Edit Box( 01 ),
),
hlistbox(
Button Box( "Ok",
ok_flag = 1;
ncol = soft_bin << get;
if (ncol < 9,
selected_col = "XX0" || char(ncol);
,
selected_col = "XX" || char(ncol);
)
),
Button Box( "Cancel", ok_flag = 0 ),
)
);
If( ok_flag,
missing_rows = masterdt << get rows where( !Is Missing( as Column( masterdt, selected_col ) ) );
If( N Rows( missing_rows ) > 0,
masterdt << select rows( missing_rows );
sbdt = masterdt << Subset( (Selected Rows), Output Table Name( "Selected Softbin Data" ) );
formula_expr = Eval Insert(
"\[sbdt << New Column( "Bin%", Numeric, Continuous, Format( "Percent", 12, 2 ), Formula( :^selected_col^ / :LOT_SORTED_DIES ) )]\"
);
Parse( Eval( formula_expr ) );
);
);