Hi,
I have written a script to select two columns from a table and do histogram. I like to be able to select an arbitary number of columns and do histogram for selected one. Can one help me achieve that? I have liste my script below. Thanks
dt = Open( "A.csv" );
xvar = .;
yvar = .;
win = New Window( "Choose Two Variables",
<<Modal,
<<On Validate(
// require the user to select two variables before clicking OK
Show( xvar, yvar );
If( Is Missing( xvar ) | Is Missing( yvar ),
0, // if xvar or yvar are missing, do nothing when OK is clicked
1
);
),
Text Box( " Select two numeric columns. " ),
H List Box(
Text Box( " Choose First " ),
x = Col List Box(
dt, // data table reference
all, // display all columns from the data table
xvar = (x << Get Selected)[1];
// get the name of the selected column before the window closes
Show( xvar );
),
Text Box( "Choose Second" ),
y = Col List Box(
dt,
all,
yvar = (y << Get Selected)[1];
Show( yvar );
)
)
);
xcol = Column( dt, xvar ); // get the columns
ycol = Column( dt, yvar );
name1 = ":" || xvar;
name2 = ":" || yvar;
name = name1 || "," || name2;
Show( name );
Eval(
Parse(
"obj1 = Distribution(
Stack(1),
Continuous Distribution( Column(" || name1 || ") ,
),
Continuous Distribution( Column(" || name2 ||
"),
)
);"
)
);