Creating an application that uses visual elements such as dialog boxes and report windows is made simpler and quicker with Application Builder. Many object properties can be set interactively rather than through code. Additionally, the resulting application is more robust, easier to maintain and more compact.
In this recipe we will build a simple parameterized application that uses a dialog for user input and displays output in a tabbed report. A parameterized application can run independently of the data table used to create it. However, column number and type in most cases cannot differ from that which was used to create the initial report. In a follow along recipe, we will see how this drawback can be circumvented.
Because of a bug in JMP 17, this application will not work correctly in test mode but will work if installed as an Add-In.
Ingredients:
Difficulty – Easy
Sample Data Tables — Cars 1993, Cities
Video Length – 4:59
Steps:
- Select File > New > Application.
- Click Blank Application. This is the most general starting point.
- In the Source panel is on the far left, under the Containers outline, drag and drop the Tab Box into the middle section of App Builder. This area contains both the workspace for creating visual elements along with any code used to extend the app beyond what is built into App Builder.
- Right click the Tab Box and select Move to Corner.
- Repeat Step 5 a second time to create a third tab.
- Open Cars 1993 data table from the sample data directory. When working with applications that require a data table, it's helpful to use a table that is less likely to have its name or location change in the future. Data tables from the sample data directory are a good choice.
- Run the Distribution, Fit Y by X and Scatterplot Matrix platforms using the Vehicle Category, Midrange Price and Highway Milage columns. For Fit Y by X choose Highway Milage as the Y and Midrange Price as the first X. Three report windows should now be at the top of the Source panel. Fit a line for the continuous X and ANOVA for the categorical X.
- Select the first tab in the Tab box. Drag the Distribution report into the drop zone on the Tab box. A reference to the data table in the Objects panel on the top right is added. Also notice that a Tab Page box has automatically been added to the Tab box.
- Select the Tab Page box and change Title to Distribution.
- Select the report and scroll to the bottom of the Properties panel at the bottom right. In the Roles outline, name the three column variables aY, bX, and cX. Each of these variables corresponds to a single column. While these names may seem suboptimal, when App Builder creates the dialog box, the column list boxes and buttons will be displayed horizontally in alphabetical order based on these names.
- Select the empty tab and repeat the process for the Fit Y by X report. Name the variables aY, bX, aY, and cX. In this cases, we are using the aY column twice.
- Finally, repeat the process for the Scatterplot Matrix report. In this case, only a single variable is needed. Call the variable yList. This variable is associated with a list of columns to be selected for the platform when it is run rather than single columns. In general, items from Analyze > Multivariate Methods and from many of the Graph platforms will allow a list of columns whereas other platforms require a one-to-one correspondence between variable and column.
- Select Application at the top of the Objects panel. Below, in the Parameter outline in the Properties panel, set aY to Y, bX to X (cont), cX to X (cat) and yList to Y List. These are the names that will appear in the column selection dialog. We’ve named the X variables as such because a continuous variables was used for bX in the reports and a categorical variable for cX. In the dialog, App Builder forces users to select columns with the same modeling types as were used when the reports were initially run.
- Before testing the app, reselect the Distribution tab. The application will display the last tab selected unless changed through scripting.
- To test the application, select another data table with at least two continuous and one categorical columns. You can use Cities from the sample data directory. Under the hotspot at far left in the topmost outline box select Run Application. App Builder applications must be run and debugged from this location. Select OZONE for Y, POP for X (continuous), Region for X (categorical), and any columns except city or State for Y List. Because the reports were created with two columns (aY and bX) as continuous and the one (cX) as categorical, the application will force a user to select columns with these roles when populating the dialog. Given the behavior of the Scatterplot Matrix platform, any columns can be selected for yList.
While this application will work in cases where the number and types of columns don't change, we need to have a way to incorporate a variable number of columns and types. This will be discussed in a follow-along recipe using this recipe as a starting point.