I've converted a column dialog() command to a New Window() display tree, and I'm having trouble with getting some of the data out of the dialog window. Ideally, I just want to grab the columns specified in the dialog window (Y and grouping variables) as well as a radio button setting and a checkbox state and a text edit box value. I was hoping to just preload this into some variables and load a function, but I can't even figure out how to get the variables from within the display tree, as the "Show(yList)" command within the ButtonBox("OK", ) shows an empty list.
Here's the function declared at the top of the script:
startAnaFn = Function ({x},
show(numParam);
show(yList);
Show(gList);
);
Here's a shorter version of my dialog:
anaDialog = new window("Select Parameters To Analyze",
vlistbox( | ||||||
colListY = ColListBox(width(lbWidth),nLines(6), minitems(1)), | ||||||
checkObj=check box({"Use inverse of Y Selection"},<<Set(0,0)), | ||||||
), |
numParam = text edit box("20"),
hlistbox( | ||
textbox(" "), | ||
ButtonBox("Ok", | ||
::yList = colListY << get selected; | ||
show (yList); // <-- this does not show expected data either | ||
gList = colListG << get selected; | ||
anaDialog << close window; | ||
startAnaFn(1)), | ||
textbox(" "), | ||
ButtonBox("Cancel", anaDialog << close window), |
),
);
PS: If this is a JMP forum, why does it assume pasted JSL code is in a table format?
I figured it out. I was using the wrong kind of "get" statement. Here is what worked:
yParamNames = colListY << get Items; |
groupNames = colListG << get Items; |
numParamVal = numParam << Get(numeric value); |
invertY = checkObj << get; |
radioRes = radioSel << get; |
anaDialog << close window; |
startAnaFn(1)), |
But I have another question. yParamNames returns the list in string format: {"column 1 name", :column 2 name", etc}.
How do I convert this to {:column 1 name, :column 2 name, etc} format?
Thanks
uggh, here is my ugly hack. I would appreciate if anyone can provide a more elegant solution. I don't know what it is with JSL but it continues to baffle me.
yParamList = {0};
// select all cols
for (i = 1, i <= ncol(dtData), i++,
column(i) << set selected(1);
);
fullList = dtData << get selected columns();
yParamList = {0};
for (i = 1, i <= n items(fullList), i++,
for (k = 1, k <= n items(yParamNames), k++,
if( char(fullList) == yParamNames
);
);
show(yParamList);