The Workflow Builder (WFB) was added in JMP 16. At the time many, but not all, interactive steps could be captured by the recording process. With every new JMP version addition steps are added. As of JMP 18, there are still process that are not recorded. What do you do when this happens? This recipe builds a Workflow to include both recorded and unrecorded steps. While these unrecorded steps may eventually be added to WFB, the process of adding missing steps, should they occur, will still apply.
The Process Screening platform will be used on data imported from an Excel Worksheet. We will also add specification limits stored in a separate JMP Data Table.
Ingredients:
- Platforms: Manage Limits, Process Screening
- Objects: Data Tables, Report Windows
- JSL Features: Workflow Builder, Object Messaging
Sample Data Tables: SpecLimits.JMP, Data 1.XLSX, Data 2.XLSX
Difficulty: Medium
Video Length: 6:50
Steps:
- Create a new Workflow, File > New > New Workflow.
- Click the red Record button at the top left.
- Import the file Data 1.XLSX using the default settings in the Excel Import Wizard. The import step is recorded to the WFB.
- Open the JMP Data Table SpecsLimits.JMP. This step is also recorded if the table was not already open. If so, close the table, delete the Close Table step from the WFB by selecting it and click on the trash can icon to the right and just above the step list. Then, reopen the table.
- Select the JMP Data Table Data 1 to make it the current table and launch the Manage Limits platform, Analyze > Quality and Process > Manage Limits.
- Select Columns A through T as Process Variables. Click OK. The platform launch is recorded.
- At the bottom of the next dialog, Click Load from Limits Table. Select the SpecLimit Data Table.
- Click Save to Column Properties.
- Close the Manage Limits dialog and the SpecLimits table. The title of the workflow step changes to Report Snapshot: Data 1 – Manage Limits.
- Stop the recording.
- Click the Rewind button to the right of the Run button in the Workflow Builder dialog. The Data 1 Data Table will close.
- Click the Run button to the left of the Rewind button. Three steps are not replayed. First, the Manage Limits dialog does not close. Second, the limits are not loaded into the Manage Limits dialog and finally, the limits are not saved as Column Properties. As of JMP 18 these three actions are not recorded by the Workflow Builder and need to be added manually.
- Start by opening the closed Step Setting outline on the right in the WFB dialog. Changes and additions to the recorded steps will be made here.
- Select the third step, Report Snapshot: Data 1 – Manage Limits. The recorded code is minimal, only launching the dialog with the selected columns.
- Open the Scripting Index under the Help menu. In most cases missing button clicks or menu choices can be implemented through a platform message found in the Scripting Index.
- Scroll to Manage Limits in the list on the far left and click on it. Frequently, the message will be identical, or very similar, to the text used in the button or menu. The Load from Limits Table message is an exact match.
- In the example on the right, the second to last line will be used as a template to launch and access the Manage Limits platform. The variable dt references the table opened in the previous line, obj is a variable that provides a reference to the platform and dtLimits references the table containing the spec limits. Copy the last line of code and return to the WFB.
- Replace the hard coded data table reference with the variable dt and precede it with obj = as in the example. We will have to add this reference and link it to the table created from the imported Excel file.
- Add a semicolon after the last statement and paste the code copied from the example after it. We will need to add a variable reference to limits table.
- Going back to the Scripting Index, find the message for adding the limits to the column properties. It, too, is identical to the button title.
- Copy the last line from the example and paste it into the Workflow step.
- Finally, we want to close the dialog. The message to do this is not as easily found since it is under the Window Object entry. Sending the Close Window message to the platform reference will close the dialog. Add it to the Workflow Step as a message that gets sent to the platform reference.
- Next, let’s change the table references. Starting with the SpecLimits table, go to the Step Settings for the second step. In front of the Open function put dtLimits = . We’ll assume the location of the table will not change. The path argument for the Open function can be relative or absolute.
- Go to step four and change the hard coded table reference to the variable reference.
- Go to the first step. We want to make a few changes here. First, we want to be able to open any Excel XLSX or XLS file, not just the one hard coded in the Step Code. For this, we’ll need to replace the current hard coded path with a path for a file selected by the user. We will use the Pick File function for this. The syntax for Pick File for our example is shown here:
filePath = Pick File("Open an Excel Worksheet",,{"Excel Files|xlsx;xls"});
The first argument is the prompt the user will see in the Open dialog. We will leave the second argument, the initial directory, blank and have Pick File dialog start in the default directory. The third is where we specify the file extensions that Pick File will make available. The argument is a list of text strings with the form Label, the pipe symbol, then one or more extensions separated by semicolons. Label is merely a user supplied text string that appears in the Open dialog and only used for Windows machines although it must be supplied, even for Macs. The example we’re using is simple and only considers two file types. For additional example, see the Pick File entry in the Scripting Index.
- Pick File returns a text string with the file path. We’ll associate it with the variable filePath and pass it to the first argument of the Open command.
- Delete the Worksheets argument. The Open function without reference to a specific Worksheet will open all Worksheets in the Workbook. Because our Excel files only contain a single Worksheet, no further data preprocessing is needed.
- Lastly, let’s add a reference to the data table that’s created from the opened Excel Worksheet. In our code below we used dt. We will precede the Open command with dt = .
- Now let’s test our Workflow. Click the Run button and select Data 2.XLSX. The Manage Limits dialog is closed and the limits are saved as Column Properties.
Note: For Workflow Final to run correctly, all files must be in the same directory because relative referencing has been used for the Open functions.