cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Creating a Dialog Box to Generate a Custom Report

Started ‎11-08-2022 by
Modified ‎11-08-2022 by
View Fullscreen Exit Fullscreen

Now, my second example is going to demonstrate a script that makes a dialog box for selective processing to make a custom report. So the user will be able to select a range of dates and process parameters and make a new data table with the custom table variables and scripts, based on user input. So I'll return to the course journal and click Process Data. And again, we have some kind of manufacturing data, where we have a date and time stamp. And I'll make that one a little wider again. We have two different presses. And what we're interested in is, are there average differences in either the Die Celsius Temp or Die Celsius Temp between the two different presses? Or maybe we're interested in both. And we also want to allow the user to select a range of dates that they want to look at. They don't have to look at necessarily all of the data. So back in the course journal, the script that creates the dialog box is called Make Specific Report. And so it has several different fields for the users to enter their information. So I will go ahead and change the analyst's Name to Monica. And for the date range, we actually have a way for users to use a calendar instead of having to manually enter the dates. So I'm going to click on the calendar for Start. And I'll just pick a date. I'll say January perhaps. And I'll do the same thing for End-- again, picking just some date. And I could move around in the calendar. I'll stick with the month of April here, and I'll pick April And then I have the option to select one or both of the Parameters. So the checkboxes mean that I could select just one or both. And I'm going to go ahead and select the Die (C) Temp. And I'll click OK. So this creates a subset data table with several different features in the Tables panel. First, we have a table variable called Notes. And if I right-click on Notes and select Edit, you can see that that note indicates the dates that I selected for the start and end range. So this is customized each time the script runs, based on the user input. And I'll Cancel to close out of that. We also have a table variable called Analyst, which has the name of the analyst. And since I can see the whole thing, I won't right-click to view that. We have a script called Source. And you may have noticed that in the other subset table, Source is a script written by JMP itself because we used a command from the Tables menu. So that just gives, in this case, the subset script of what rows and columns were pulled into this data table. And again, JMP creates that sort of script automatically whenever you create new tables using the tables command, either interactively or through a script. So that's a script that you can keep in the table or you could delete it, if you didn't need it there. And you can delete that with your script, in fact, as well. And then we have a Oneway script. And so the Make Specific Report script itself created this analysis script. It did not automatically run it, although that is also an option. But we could go ahead and run that Oneway script. And so here I have the Oneway Analysis of the parameter I selected, Die By Press A versus B. Let's take a look at the script that JMP would write to recreate this analysis. So I'll go to the red triangle next to Oneway Analysis and select Save Script, To Script Window. And so I see the name of the JMP platform, Oneway. Just like we did with the bivariate example, I see the Y and X roles. In the X role, I see that colon scoping operator followed by the name of the column, Press. But in the Y role, I see something a little different. I see the word Name, and then in parentheses a character string with the name of the column. And the reason for this is that we have a disallowed character in the column name. The parentheses are not part of the allowable syntax for column names. So Name is a special parser directive that we can use if we have names that have disallowed characters. So in this example, you have the word Name and then, again, the character string with the double quotes, and the name of that column. In a moment, I'm going to show you another syntax for that, the syntax of the script that's saved to the data table. But before I do that, I'll just mention that we have two things that we didn't see in the bivariate example. We have the word Means with afterward and Mean Diamonds And in these cases, these are options from the red triangle menu in the Oneway Analysis platform. And the is simply a Boolean value requesting that we turn these options on. So means is actually synonymous with the word ANOVA that you'll see if you go to that red triangle-- Means/Anova. Also, Pooled t, in this example. So that just requests the analysis of variance. And then the Mean Diamonds requests that those green diamonds be turned on. And they are turned on by default when we request the analysis of variance. But suppose you knew that users oftentimes turned that off in their preferences. You would ensure that they would be displayed with this code in line I'm going to go back to the Die Temperature data table, that subset data table, and I want to look at the Oneway script that the Make Specific Report script added here. I'm going to right-click on the green play button and select Edit. And it looks very similar to the one that JMP wrote for me. A few changes-- one is we have an alternate syntax for names with disallowed characters. So using the curly brackets around the character string is equivalent to using the Name parser directive. So you might see both of those syntaxes if you look at other scripts that people have written. And then the only other thing is that we have specifically requested in the script that the original Make Specific Report script wrote that we not display box plots. They're not displayed by default, but again, sometimes we want to make sure that user preferences don't change how our output is displayed. So that after Box Plots is a Boolean value saying to not display those. So I'm going to Cancel out of the script from the data table. And so these are just two examples of the things that we can do with JSL. And you can kind of keep these in mind as we learn the different ways to use the scripting language, the syntax, and the things we can do throughout the course. I'm going to return to the course journal. And we have a script here. This is one of the scripts that's initialized by that initial setup script, called Delete All Save None. And I just want to make sure that that Delete All Save None will not distinguish between the windows that are open associated with the course and any other JMP windows you might have open for your own work. So if you do use this journal, just be aware that the Delete All Save None does exactly what it says. So don't use that if you have your own work open with any unsaved changes. So I'll click that. I will be prompted about saving changes to the script window, so I'll say no. And then I'll click Next to advance into the next outlined item of the course.