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