Hello. I'm writting a script to automate the creation of control charts based on some configuration I'm reading in for each chart to be created. Below is a code snipet for creating a control chart. This chart contains two different phases where the Phase Level command is used to specify the Sigma and Avg within the phases.
chart = Control Chart(
Sample Label ( Column(dt, chartConfig["XParamName"]) ),
Phase( Column(dt, chartConfig["PhaseColumn"]) ),
Group Size( 1 ),
Chart Col(
column(dt,chartConfig["YParamName"]),
Individual Measurement(
Phase Level( "1", Sigma(p1_CL_Range/3), Avg(p1_Mean_calc)),
Phase Level( "2", Sigma(p2_CL_Range/3), Avg(p2_Mean_calc))
)
)
);
I'd like to be able to do this for any number of phases, where I would have the phases specified in my configuration info and loop through them. But I don't know how to make a call to Phase Level () like that. I figure there are maybe three options :
- create the control chart object without the Phase Level info and then issue a message (or Send to Report - Dispatch) to the control chart object that will add the Phase Levels in a for loop and then call chart << Redo Analysis(),
- have a function with a loop embedded within the Control Chart( Chart Col(Individiaul Measurement ())) commands, but I don't know how to do that or if it is possible, or
- have the for loop before the Control Chart() command, and save the Phase Level() commands to a list variable and then use that list somehow within the Control Chart () command.