This example builds the WorkflowBuilderIfElse.jmpflow found in the Sample Workflow folder. The workflow presents the user with a Oneway plot and asks whether they want to execute an ANOVA or a nonparametric test. To open the sample workflow select Help > Sample Index, click the Sample Index red triangle and select Open Sample > Workflow. Open WorkflowBuilderIfElse.jmpflow. To build the workflow follow the steps below.
To build the if/else structure, record each option and then add the if/else steps to the workflow.
1. Select File > New > Workflow.
2. Select Help > Sample Data Folder and open Tablet Production.jmp.
3. Click Yes in the Record Action pop-up window.
1. Select Analyze > Fit Y by X.
2. Select Screen Size and click X, Factor.
3. Select Disso and click Y, Response.
4. Click OK.
Note: A step named Launch platform: Oneway is added to the workflow.
5. Click the Oneway Analysis red triangle and select Normal Quantile Plot > Plot Actual by Quantile.
6. Click the Oneway Analysis red triangle and select Quantiles.
7. Close the Oneway report.
Note: The step named Launch platform: Oneway is replaced with the Report snapshot step.
8. Double click the Report snapshot step in the workflow to view the Step Settings for the Report snapshot.
9. In the Step Code section, add Oway = before the Data Table command. This provides a reference to the Oneway report so that you can close it later.
1. Select Analyze > Fit Y by X.
2. Click Recall.
3. Click OK.
4. Click the Oneway Analysis red triangle and select Normal Quantile Plot > Plot Actual by Quantile.
5. Click the Oneway Analysis red triangle and select Quantiles.
6. Click the Oneway Analysis red triangle and select Means/Anova.
7. Close the Oneway report.
8. Click on the most recent Report snapshot: Tablet Production step to open the Step Settings and type ANOVA as the Step name.
1. Select Analyze > Fit Y by X.
2. Click Recall.
3. Click OK.
4. Click the Oneway Analysis red triangle and select Normal Quantile Plot > Plot Actual by Quantile.
5. Click the Oneway Analysis red triangle and select Quantiles.
6. Click the Oneway Analysis red triangle and select Nonparametric > Wilcoxon / Kruskal-Wallis Test.
7. Close the Oneway report.
8. Click on the most recent Report snapshot: Tablet Production step to open the Step Settings and type Wilcoxon as the Step name.
9. Click to stop recording.
The following steps add the if else structure to your workflow.
1. Click the Workflow Builder red triangle and select Advanced > Add If.
2. Click the Workflow Builder red triangle and select Advanced > Add Else.
3. Drag the ANOVA step onto the If step.
4. Drag the Wilcoxon step onto the Else step.
5. Click the If step and go to the Step Settings. In the Condition section, replace the default 1; with varNorm== “ANOVA (normality)”. This specifies a variable name for the condition.
6. In the Step Settings pane, click the Add action menu and select Show Message. Fill in the sections with the following information.
– Select Modal for the message type on the right side of the options section.
– Set the title to “Choose option to compare group means”.
– Set the Message to “Review the Oneway analysis. Select one of the options below to compare the group means.”.
– Set the prompt type to Radio Box.
– Set the JSL variable to varNorm.
– Set the choices to “ANOVA (normality)” and “WILCOXON (nonparametric test)”.
7. In the Step Settings pane, from the Add action menu select Custom and complete the custom action with the following information.
– Set the name to “close oneway report” and click OK.
– Specify the JSL code to run: Oway << close window;
– In the Step Action Timeline pane, select the close step and use the down arrow to move the step to the At end section.
8. Click to reset. This closes any open windows and resets the workflow to the start.
9. Click to test the workflow.
The initial Oneway report appears with a window for the user to select either the ANOVA or the Wilcoxon test to run. Select an option and click OK. The initial Oneway report closes and a Oneway report with the selected test appears. To test the alternative option, click the reset button and then click the run button to rerun the workflow.