I have been working to automate a Process Screening Analysis.
I have a textbox popup which prompts the user to put in a date in the yyyy-mm format. Then I have a button to save the date as a variable. Next, I have a button which runs the Process Screening Analysis. In addition to that, I put in a local data filter using the user input to do the analysis on only that set of the data. This works fine.
However, I also want to take advantage of the Control Chart for Selected Items option which I put as the last argument of the Process Screening module. The second to last argument is Select All. The result I get shows the Control Charts with the correct grouping but not the correct filtering (all data from the data table is used to create the charts).
I have two questions. How can I make sure only the data that has been filtered by the Local Data Filter be used to create the charts?
(If I create the charts I want using the red triangle from the Process Screening module and then grab that script I will end up with a lot of hardcoded values which might not work for a later analysis)
Second question is how can I recall the control charts for further processing or saving? I have not been able to figure out how to save them to another variable or export them. Earlier I save the process screening analysis to a variable and then use << report; and save as a powerpoint but only the process screening shows up without the control charts.
Any help or resources would be appreciated.
Here is snipped of my code
year = Char( Year( Today() ) );
month = Char( Month( Today() ) );
date = Concat Items( {year, month}, "-" );
w = New Window( "Date Filter",
Border Box( top( 30 ), bottom( 20 ), Left( 30 ), Right( 30 ),
V List Box(
H Center Box( Text Box( "Date Filter\!n\!nPlease enter date in yyyy-mm format" ) ),
Spacer Box( size( 1, 30 ) ),
H List Box( Text Box( "Date: " ), b1 = Text Edit Box( date ) ),
Spacer Box( size( 1, 15 ) ),
Spacer Box( size( 1, 15 ) ),
H Center Box(
Button Box( "Save Filter Date",
b2 = b1 << Get Text();
)
),
H Center Box(
Button Box( "Get Process Capability",
Current Data Table( dt2 );
dt4 = Process Screening(
Process Variables(
:"Metric1", :"Metric2",:"Metric3"),
Grouping( :"MetricA" ),
Control Chart Type( "Indiv and MR" ),
Process Performance Graph( 1 ),
Show Tests( 0 ),
Target Index( 1 ),
Cp( 1 ),
Spec Limits( 1 ),
Use Limits Table(1,Data Table( dt3 ),Process Variables( :Process ),Grouping( :"MetricA" ),LSL( :LSL ),USL( :USL ),Target( :Target ),Go),
Local Data Filter(Add Filter( columns( :"ProcessDate" ), Where(:"ProcessDate" == b2 ))),
SendToReport( Dispatch( {}, "", TableBox, {Sort By Column( 2, 1 )} ) ),
Select All,
Control Charts for Selected Items,
);
)
)
)
)
);