If column BIN_NO is numeric, you might need the num() function.
dt << select where( dt:BIN_NO == num( theBinNumber ) );
BTW, I agree with Jim. You can get a script to work by using one supplied on the blog page, but soon you will be asked to make changes, especially to make it robust. For example, the script below should also include
- a check for the data type of BIN_NO
- handle the case if BIN_NO could have empty values.
- check the number of rows in _idx, to determine if enough rows to do the analysis etc.
Here is an alternative
Names Default to Here(1);
dt = current data table();
//create a list of available bins
validbins = Associative Array(:BIN_NO) << get keys;
BIN_num = empty();
minrows = 1;
rslt = New Window("User Selection", <<Modal, <<Return Result,
HListBox(
Panel Box("Enter the Bin number to analyze",
Lineup Box(
2,
nb = Number Edit Box( 0 , <<Set Increment(1), <<Set Show Spin Box(1)),
) //end 1st lineup box
),
Panel Box("Action",
Lineup Box(ncol(1),
ok_bb= ButtonBox("OK"),
cncl_bb=ButtonBox("Cancel"),
)// end 2nd lineup box
)
)
);
//don't run if empty
if(rslt["Button"]==-1, BIN_num = empty(); Throw());
BIN_num = rslt["nb"];
If (IsMissing(BIN_num) | !Contains(validbins, BIN_num),
Caption( char(BIN_num)||" is not a valid bin number, aborting");
wait(2);
Caption(remove);
Throw()
);
show(BIN_num);
_idx = dt << get rows where(dt:BIN_NO == BIN_num);
If(nrow(_idx) >0,
subdt = dt << Subset(Rows(_idx), OutputTableName (dt<<get name || " - BIN " ||char(BIN_num) ))
);