Choose Language Hide Translation Bar
adam
Community Trekker

Multiple parameter selection

Hi,

 

I have the following script that will tabulate test_type_combo by few tests(Test1, Test2, Test3, Test4, Prepass) each with sum the n_unit and n_unit_passed for a parameter named coil_supplier_A. Then will create a new column, Yield. From here, I will have Graph builder to do the plotting. Can I know if I have multiple parameter for suppliers, each in a column eg. coil_supplier_B, coil_supplier_C and coil_supplier_D, how can I put all suppliers into the script and auto plot everyone(in this case there will be total 4 plots). Or perhaps if there is other better way to do it. 

 

Many thanks.

 

Script:

 

dt = Current Data Table();
tab= dt << Tabulate(
Add Table(
Column Table(
Grouping Columns( :test_type_combo ),
Analysis Columns(
:Name( "Sum(n_unit)" ),
:Name( "Sum(n_unit_passed)" )
)

),
Row Table(
Grouping Columns(
:work_week,
:coil_supplier_A,
:product_family

)
)
)
);
dtTab= tab << makeIntoDataTable;
dtTab << new column("Yield",numeric,Formula(
(:Name( "Sum(Sum(n_unit_passed), PrePass)" ) /
:Name( "Sum(Sum(n_unit), PrePass)" )) * (
:Name( "Sum(Sum(n_unit_passed), Test1)" ) /
:Name( "Sum(Sum(n_unit), Test1)" )) * (
:Name( "Sum(Sum(n_unit_passed), Test4)" ) / :Name( "Sum(Sum(n_unit), Test4)" )
) * (:Name( "Sum(Sum(n_unit_passed), Test2)" ) /
:Name( "Sum(Sum(n_unit), Test2)" )) * (:Name(
"Sum(Sum(n_unit_passed), Test3)"
) / :Name( "Sum(Sum(n_unit), Test3)" )) * 100
)
);
dtTab << Graph Builder(
Variables(
X( :work_week ),
Y( :PFY ),
Y( :Name( "Sum(Sum(n_unit), Test1)" ) ),
Group X( :product_family ),
Overlay( :coil_supplier_A )
),
Elements(
Position( 1, 1 ),
Points( X, Y, Legend( 6 ) ),
Line( X, Y, Legend( 7 ) )
),
Elements( Position( 1, 2 ), Bar( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model( 6, Base( 0, 0, 0 ), Base( 1, 0, 0 ), Base( 2, 0, 0 ) )}
),
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "coil_supplier_A" )}
),
Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( "unit Qty" )} ),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {6, [0, 1, 2], 7, [6, 7, 8], 4, [3, 4, 5]} ),
Position( {0, 1, 2, 6, 7, 8, 3, 4, 5} )}
)
)
);

 

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Multiple parameter selection

Here is one way of generating all of the coil supplier output, using Substitution with a For loop

Names Default To Here( 1 );
dt = Current Data Table();
VarList = {"coil_supplier_A", "coil_supplier_B", "coil_supplier_C", "coil_supplier_D"};
For( i = 1, i <= N Items( VarList ), i++,
	Eval(
		Substitute(
				Expr(
					tab = dt << Tabulate(
						Add Table(
							Column Table(
								Grouping Columns( :test_type_combo ),
								Analysis Columns( :Name( "Sum(n_unit)" ), :Name( "Sum(n_unit_passed)" ) )

							),
							Row Table( Grouping Columns( :work_week, __supplier__, :product_family ) )
						)
					);
					dtTab = tab << makeIntoDataTable;
					dtTab << New Column( "Yield",
						numeric,
						Formula(
							(:Name( "Sum(Sum(n_unit_passed), PrePass)" ) / :Name( "Sum(Sum(n_unit), PrePass)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test1)" ) / :Name( "Sum(Sum(n_unit), Test1)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test4)" ) / :Name( "Sum(Sum(n_unit), Test4)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test2)" ) / :Name( "Sum(Sum(n_unit), Test2)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test3)" ) / :Name( "Sum(Sum(n_unit), Test3)" )) * 100
						)
					);
					dtTab << Graph Builder(
						Variables(
							X( :work_week ),
							Y( :Yield ),
							Y( :Name( "Sum(Sum(n_unit), Test1)" ) ),
							Group X( :product_family ),
							Overlay( __supplier__ )
						),
						Elements( Position( 1, 1 ), Points( X, Y, Legend( 6 ) ), Line( X, Y, Legend( 7 ) ) ),
						Elements( Position( 1, 2 ), Bar( X, Y, Legend( 4 ) ) ),
						SendToReport(
							Dispatch( {}, "400", ScaleBox, {Legend Model( 6, Base( 0, 0, 0 ), Base( 1, 0, 0 ), Base( 2, 0, 0 ) )} ),
							Dispatch( {}, "graph title", TextEditBox, {Set Text( __qsupplier__ )} ),
							Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( "unit Qty" )} ),
							Dispatch(
								{},
								"400",
								LegendBox,
								{Legend Position( {6, [0, 1, 2], 7, [6, 7, 8], 4, [3, 4, 5]} ), Position( {0, 1, 2, 6, 7, 8, 3, 4, 5} )}
							)
						)
					);
				),
			Expr( __supplier__ ), Parse( ":" || VarList[i] ),
			Expr( __qsupplier__ ), VarList[i]
		)
	)
);
Jim

View solution in original post

6 REPLIES 6
Highlighted
cwillden
Super User

Re: Multiple parameter selection

Hi @adam,

It would be helpful to see a sample data set in order to better understand what you are describing.  If there is an IP issue, maybe you can use the anonymize function or create an example data set with dummy data that works with your script.

-- Cameron Willden
0 Kudos
Highlighted
adam
Community Trekker

Re: Multiple parameter selection

Hi Cameron,

 

I attached the data set for better understanding.

 

dt = Current Data Table();
tab= dt << Tabulate(
Add Table(
Column Table(
Grouping Columns( :test_type_combo ),
Analysis Columns(
:Name( "Sum(n_unit)" ),
:Name( "Sum(n_unit_passed)" )
)

),
Row Table(
Grouping Columns(
:work_week,
:coil_supplier_A,
:product_family

)
)
)
);
dtTab= tab << makeIntoDataTable;
dtTab << new column("Yield",numeric,Formula(
(:Name( "Sum(Sum(n_unit_passed), PrePass)" ) /
:Name( "Sum(Sum(n_unit), PrePass)" )) * (
:Name( "Sum(Sum(n_unit_passed), Test1)" ) /
:Name( "Sum(Sum(n_unit), Test1)" )) * (
:Name( "Sum(Sum(n_unit_passed), Test4)" ) / :Name( "Sum(Sum(n_unit), Test4)" )
) * (:Name( "Sum(Sum(n_unit_passed), Test2)" ) /
:Name( "Sum(Sum(n_unit), Test2)" )) * (:Name(
"Sum(Sum(n_unit_passed), Test3)"
) / :Name( "Sum(Sum(n_unit), Test3)" )) * 100
)
);
dtTab << Graph Builder(
Variables(
X( :work_week ),
Y( :Yield ),
Y( :Name( "Sum(Sum(n_unit), Test1)" ) ),
Group X( :product_family ),
Overlay( :coil_supplier_A )
),
Elements(
Position( 1, 1 ),
Points( X, Y, Legend( 6 ) ),
Line( X, Y, Legend( 7 ) )
),
Elements( Position( 1, 2 ), Bar( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model( 6, Base( 0, 0, 0 ), Base( 1, 0, 0 ), Base( 2, 0, 0 ) )}
),
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "coil_supplier_A" )}
),
Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( "unit Qty" )} ),
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {6, [0, 1, 2], 7, [6, 7, 8], 4, [3, 4, 5]} ),
Position( {0, 1, 2, 6, 7, 8, 3, 4, 5} )}
)
)
);

 

 

Thank you.

Adam 

0 Kudos
Highlighted
txnelson
Super User

Re: Multiple parameter selection

Here is one way of generating all of the coil supplier output, using Substitution with a For loop

Names Default To Here( 1 );
dt = Current Data Table();
VarList = {"coil_supplier_A", "coil_supplier_B", "coil_supplier_C", "coil_supplier_D"};
For( i = 1, i <= N Items( VarList ), i++,
	Eval(
		Substitute(
				Expr(
					tab = dt << Tabulate(
						Add Table(
							Column Table(
								Grouping Columns( :test_type_combo ),
								Analysis Columns( :Name( "Sum(n_unit)" ), :Name( "Sum(n_unit_passed)" ) )

							),
							Row Table( Grouping Columns( :work_week, __supplier__, :product_family ) )
						)
					);
					dtTab = tab << makeIntoDataTable;
					dtTab << New Column( "Yield",
						numeric,
						Formula(
							(:Name( "Sum(Sum(n_unit_passed), PrePass)" ) / :Name( "Sum(Sum(n_unit), PrePass)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test1)" ) / :Name( "Sum(Sum(n_unit), Test1)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test4)" ) / :Name( "Sum(Sum(n_unit), Test4)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test2)" ) / :Name( "Sum(Sum(n_unit), Test2)" )) * (
							:Name( "Sum(Sum(n_unit_passed), Test3)" ) / :Name( "Sum(Sum(n_unit), Test3)" )) * 100
						)
					);
					dtTab << Graph Builder(
						Variables(
							X( :work_week ),
							Y( :Yield ),
							Y( :Name( "Sum(Sum(n_unit), Test1)" ) ),
							Group X( :product_family ),
							Overlay( __supplier__ )
						),
						Elements( Position( 1, 1 ), Points( X, Y, Legend( 6 ) ), Line( X, Y, Legend( 7 ) ) ),
						Elements( Position( 1, 2 ), Bar( X, Y, Legend( 4 ) ) ),
						SendToReport(
							Dispatch( {}, "400", ScaleBox, {Legend Model( 6, Base( 0, 0, 0 ), Base( 1, 0, 0 ), Base( 2, 0, 0 ) )} ),
							Dispatch( {}, "graph title", TextEditBox, {Set Text( __qsupplier__ )} ),
							Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( "unit Qty" )} ),
							Dispatch(
								{},
								"400",
								LegendBox,
								{Legend Position( {6, [0, 1, 2], 7, [6, 7, 8], 4, [3, 4, 5]} ), Position( {0, 1, 2, 6, 7, 8, 3, 4, 5} )}
							)
						)
					);
				),
			Expr( __supplier__ ), Parse( ":" || VarList[i] ),
			Expr( __qsupplier__ ), VarList[i]
		)
	)
);
Jim

View solution in original post

Highlighted
adam
Community Trekker

Re: Multiple parameter selection

Thanks a lot, Jim !!

0 Kudos
Highlighted
Byron_JMP
Staff

Re: Multiple parameter selection

Instead of making the intermediate table...

 

Maybe something like this would work?

 

Try stacking the coil supplier columns (and only the coil supplier columns)

This will result all the coil supplier columns being reduced to two cols. One has the coil supplier, the other has the lot IDs.  The Lot ID still goes into the Graph builder Overlay role, but the Supplier ID goes into the Page Role (bottom right hand corner of Graph builder (jmp 13 option)).

Also, since all the data is stacked, the formula gets easy, because it operates on only the count and pass cols.

 

 

 

JMP Systems Engineer, Pharm and BioPharm Sciences
Highlighted
adam
Community Trekker

Re: Multiple parameter selection

Byron, that will do too. Thanks!
0 Kudos