Subscribe Bookmark RSS Feed

generate N 'fit y by x' charts for N unique values in column (where == unique values from column)

jmpbeginner

Community Trekker

Joined:

Sep 11, 2013

I need to generate multiple fit y by x graphs. the number of graphs generated will vary based on the unique values in the 'RECIPE' column (used in the where clause)

example:

Oneway(

  Y( :VALUE ),

  X( :TOOL ),

  Box Plots( 1 ),

  X Axis Proportional( 0 ),

  Grand Mean( 0 ),

Where( :RECIPE == "RecipeA" )

SendToReport(generate

etc

etc

etc

RECIPE column could contain any number of unique values ("RecipeA", "RecipeB", "Recipe67283", etc...), thus generating any number of different y by x graphs for each unique RECIPE.

when I copy the jump script, it just generates an additional block of code for each unique Where( :RECIPE == "__________") value.   

I need this script to apply to any dataset, so i cannot specifically call out a string to match in the Where clause since these strings will vary based on the dataset!

I tried using a wildcard (?) in the Where string and that didn't work:

example

Oneway(

  Y( :VALUE ),

  X( :TOOL ),

  Box Plots( 1 ),

  X Axis Proportional( 0 ),

  Grand Mean( 0 ),

  Where( :RECIPE == "?" )

SendToReport(generate

etc

etc

I'm guessing the best way to accomplish this is to utilize Associative Arrays?

If i use this code to create an array of unique RECIPES:

uniqueRecipes = associative array(:RECIPE);

and then try to grab a specific key value, say the first one:

Oneway(

  Y( :VALUE ),

  X( :TOOL ),

  Box Plots( 1 ),

  X Axis Proportional( 0 ),

  Grand Mean( 0 ),

  Where( :RECIPE == uniqueRecipes <<First )

SendToReport(generate

etc

etc

the above did not work..

but if i run just this line of code:

uniqueRecipes <<First

I get the correct string returned:

"RecipeA"

I am completely stumped.. maybe using associative arrays is just the wrong approach to begin with and there is an easier way?  My thought was that if i could use array values in the Where clause, then i could use some sort of loop to iterate through each of the unique values in the array...



any help is GREATLY appreciated!  thank you for your time

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Oneway (

    Y( :VALUE ),

    X( :TOOL ),

    By( :RECIPE )

);

3 REPLIES
Solution

Oneway (

    Y( :VALUE ),

    X( :TOOL ),

    By( :RECIPE )

);

jmpbeginner

Community Trekker

Joined:

Sep 11, 2013

Wow that worked! so simple, yet I was making it so complex...  when i copied the script that JMP wrote by way of selecting from UI, it had used the Where( ) command and not the By( )

thank you! you just saved me hours of frustration!

mpb

Super User

Joined:

Jun 23, 2011

When you interactively use a platform and specify a By variable, then instead of using Script to save the script, use Script All By-Groups from the same red triangle pull down menu. Then you'll see By instead of multiple Where blocks.