- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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} )}
)
)
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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]
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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]
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Multiple parameter selection
Thanks a lot, Jim !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content