update a combo box in which the list comes from a data table that has to be opened by the user<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Background
I am creating a small application with tabs, in one of them I request the user to open a data table
In another tab I have a combo box that displays a list of unique values (“unique_copy_list’) of a column of that data table
cbx1=try(Combo Box(unique_copy_list),),
Problem:
When application is launched not data table is selected thus the “unique_copy_list” is not available,
There is a way to refresh there the combo box?
Or it's better to use different approach
Re: update a combo box in which the list comes from a data table that has to be opened by the userThanks guys for your support. Point taken, I will upgrade soon. Anyway with remove & append I got the job done.
Re: update a combo box in which the list comes from a data table that has to be opened by the userJSL syntax evolves over time so if you are using a really old version of JMP then it really helps to mention this when you post a request for help. What you are trying to do can be done in version 9, but the methods of updating list boxes and combo boxes have changed since then. I thought Set Items was new to version 10 but maybe I'm wrong, but I know that in current versions this is much easier as illustrated by Peter. You can still use the core principle though, which is to send messages to the combo box once the data table is selected. A long-winded approach is to iteratively remove items (<Re: update a combo box in which the list comes from a data table that has to be opened by the user
I use JMP 9.0.2
I used all the code you send me to validate solution just changing the column name from "customer" by “Copy” but this is not relevant since unique_copy_list variable contains the right information however seems that she set items commands does not have the desired effect
Re: update a combo box in which the list comes from a data table that has to be opened by the userCan you post your code? Also what version of JMP are you using? My program only works if you open the sample dataset called "Bands Data".
Re: update a combo box in which the list comes from a data table that has to be opened by the userThank you for your fast response, still set items command does not refresh the mentioned combo box :S
It runs ok but no log error but the combo box does not reflect it
Also I run your full script (thanks again) and still nope
Re: update a combo box in which the list comes from a data table that has to be opened by the userYou need to set up a callback to load the combobox. Here's a little example. You have to open the Bands Data example dataset for this to work. I've also included a function to get the unique values for a column.
/* Function Name Get Unique Values
Description: Get the unique values for a column. For example:
Indications
------------
AAAAA
BBBBB
AAAAA
CCCCC
CCCCC
unique_list = get unique values (:Indications)
will return {"AAAAA", "BBBBB", "CCCCC"}
Arguments:
dtcol column descriptor to calculate unique values for
*/
Get Unique Values = Function( {dtcol},{default local},
// Eval/expr trickery to get this to work.
eval(eval expr(
Summarize(unique_list = By(expr(dtcol)))));
unique_list;
);
nw = new window("Test",
tab box(
"First tab",
open_button = button box("Open",
dt = open();
// This example will work with Bands Data...
unique_copy_list = get unique values(column(dt, "customer"));
cbx1 << set items(unique_copy_list);
),
"Second tab",
cbx1 = Combo Box(), // Initially this will be empty
)
);