Subscribe Bookmark RSS Feed

Create a launcher for a JMP application which lets user select from open data tables

kca

Community Trekker

Joined:

Nov 22, 2011

I am trying to create a JMP application (trying to learn on the fly) for a project.  I want the user to select a data table from a list of open data tables which pass some sanity tests (e.g. has the right column names) from which the application will generate reports.  I have some JSL code which generates the list of data tables which pass the sanity tests. However, I don't know how to display the list in a launcher.

Something like the Selected Data Table Combo box (no idea what it's called, screenshot attached) visible in the Script Editor just above the editing box, along with some "Run" and "Cancel" buttons would do the trick.  Can someone point me in the right direction with respect to terminology, or point me to example code?

Thanks for your help.

1 REPLY
pmroz

Super User

Joined:

Jun 23, 2011

Try this code.  You'll need to insert logic to check the column names, but the framework should help.

num_tables = ntable();

dataset_list = {};

For (i = 1, i <= num_tables, i++,

    dt = Data Table(i);

    column_names = dt << get column names;

// Check column names here

//    .

//    .

// Force it to be true for now

    valid_columns = 1;

    if (valid_columns,

        one_name = dt << Get Name;

        Insert Into(dataset_list, one_name);

    );

);    // end for

// Get the corrected number of CAW datasets

num_tables = nitems(dataset_list);

if (num_tables == 0,

    no_tables_win = new window("Error Alert", << modal,

        textbox("No dataset has been opened for use yet."),

    );

    current_dataset = "";

    dataset_name    = "";

    Throw("No Dataset Opened")

);

if (num_tables == 1,

// then

    current_dataset = dt;

    dataset_name    = one_name;

// else

    ,

    select_table_win = new window("Select Table", << modal,

        panel box("Select table for analysis",

            table_cb = combo box(dataset_list),

            hlist box(

                button box("OK",

                    ok_button = 1;

                    dataset_name = table_cb << get selected;

                    current_dataset = data table(dataset_name);

                ),

                button box("Cancel",

                    ok_button = 0;

                ),

            ),

        );

    );

);

if (!ok_button,

    throw("No table selected");

)