Subscribe Bookmark RSS Feed

Having troulble with a dialog box script

vinkane

Community Trekker

Joined:

Dec 23, 2013

Having troulble with a dialog box script to have the user select 1 or more selections, from a column of 100K rows. The column has no more then 6 different choices.

Thanks for the help

2 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

Something like this, perhaps?

NamesDefaultToHere(1);

// Sample Character Data

dt = NewTable("Test Data", NewColumn("Column", Numeric, Nominal, Formula(RandomInteger(0, 10))), AddRows(10000));

dt << runFormulas;

Column(dt, "Column") << deleteFormula;

Column(dt, "Column") << dataType(Character);

// Dialog

distinctVals = AssociativeArray(Column(dt, "Column") << getValues) << getKeys;

nw = NewWindow("Select One or More Values",

lb = listBox(distinctVals, validateScript),

bb = ButtonBox("OK", OKscript, Enable(0))

);

// Validate script

validateScript =

Expr(

if(NItems(lb << getSelected) > 0, bb << Enable(1), bb << Enable(0));

);

// OK script

OKscript =

Expr(

nw << closeWindow; vals = lb << getSelected; Print(vals);

);

vinkane

Community Trekker

Joined:

Dec 23, 2013

Thanks....works well