Hello,
I am trying to display a New Window() to request the user to select some categorical factors from a data table in a List Box().
I would like to add more insight to this choice, by highlighting:
- the number of level for each factors
- a color to show the ratio of empty cells within each factors columns
see attached an example of what I would like to achieve.
In the following script, I calculate the info for each factor and populate a list "Value".
But then I don't know how to aproach the design of the List Box () with these infos
Thanks for your help
- voiz

Names Default To Here( 1 );
clear symbols();
Deletesymbols();
dt = New Table( "RawData",
Add Rows( 20 ),
New Column("factor1", Character, set values( {"A","A","A","A","A","A","A","B","B","B","B","B","B","C","C","C","C","C","C","C"})),
New Column("factor2", Character, set values( {"T0","DROP1","DROP2","DROP3","DROP4","DROP5","DROP6","T0","DROP1","DROP2","DROP3","DROP4","DROP5","T0","DROP1","DROP2","DROP3","DROP4","DROP5", "DROP6"})),
New Column("factor3", Character, set values({"1","1","1","2","2","", ,"","","" ,"" ,"", "","3","3","3","3"}) ),
New Column("factor4", Character, set values({"a","a","a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b" , "b", "b", "b", "b"}) );
);
RawDataCol = dt << get column names ("character");
show (RawDataCol);
for(i=1, i<= N items (RawDataCol), i++,
FactorSummary = {};
Eval(Eval Expr(FactorSummary = Column(dt, Expr(char(RawDataCol[i]))) << get values));
//show (FactorSummary);
//find cell count (non empty)
Eval(Eval Expr(For( j = N Items(FactorSummary), j > 0, j--,
If( FactorSummary[j] == "",
Remove From( FactorSummary, j, 1 )
)
)));
//Find number of level within a factor (non empty)
Eval(Eval Expr(Summarize( LevelSummary = by(Column(dt, Expr(char(RawDataCol[i])))) )));
Eval(Eval Expr(For( j = N Items(LevelSummary), j > 0, j--,
If( LevelSummary[j] == "",
Remove From( LevelSummary, j, 1 )
)
)));
//show (LevelSummary);
Eval(Eval Expr(Value = {Expr(RawDataCol[i]), Expr(N items(LevelSummary)), Expr(N items (FactorSummary) / N row(dt))}));
show (Value);
);
MainWindow = New Window( "Select Factors",
<<Modal,
<<ReturnResult,
V List Box(Align(center),
Panel Box( "Select factors to run the analysis",
Lineup Box( N Col( 2 ), Spacing( 5 ),
PickData = List Box( RawDataCol ) ) )
));