Copy a list to a Listbox in Application BuilderHi all,
I am building an add-in in Application Builder that uses the inputs of a Listbox as a query. However, for a large number of queries this is complicated. I would like to be able to copy a list from rows in a table to a Listbox in Application Builder, how can I do that? Thanks in advance.
Re: Copy a list to a Listbox in Application BuilderHi,
Below is a example of how to use the JMP Application Builder for that purpose. Also attached is a table containing tags in the first column. Simply select and copy the tags to your clipboard, and use the buttons in the Application to paste them into the listbox. Take a look at the script in the application to see how the buttons work. Does this help?
Re: Copy a list to a Listbox in Application BuilderHi again,
Just to add some functionality if desired, you can add a button that copies all items in List1 for later use (such as to use as a filter in a query):
Button3Press=Function({this},
// This function is called when the button is pressed
List1items=List1<<GET items=""></GET>
Alternatively, if you wanted to allow a user to select the items in the list to be used in the query:
Button4Press=Function({this},
// This function is called when the button is pressed
List1selected=List1<<GET selected=""></GET>
This may be useful if someone copies all the tags they may need in a given day to the list, and then selects from among those as they run various queries.
Re: Copy a list to a Listbox in Application BuilderYou can also load the data dynamically from a table into an application builder listbox. Here's a simple example where I have two listboxes, brand_lb and name_lb. I'm adding brand and name information from the Candy Bars dataset.
Here's the layout:

Here's the script section:
// This script is executed when a new module instance is
// created. The pre-defined object "thisModuleInstance" refers
// to the instance object, but other objects such as boxes and
// scripts have not yet been created. Variables declared here are
// scoped to the ModuleInstance namespace.
// This special function will receive parameters passed to CreateInstance()
OnModuleLoad({},
);
thisModuleInstance << Create Objects;
// After this point your module instance objects have been created
// and can be referred to by name (for example, "Button1").
dt = open("$sample_data\Candy Bars.jmp");
brand_list = dt:brand << get values;
name_list = dt:name << get values;
brand_lb << set items(brand_list);
name_lb << set items(name_list);
close(dt, nosave);
Here is what it looks like:
