I problemi che devi risolvere riguardano un numero sconosciuto di colonne Y e quindi come inserire quel numero sconosciuto di colonne Y nel Generatore di carte di controllo.Di seguito è riportato un modo per farlo
/* Query the user for X and Y columns */
cdlg = Column Dialog(
yCol = ColList( "Y, Response", MinCol( 1 ), MaxCol( 25 ), Data Type( "Numeric" ) ),
xCol = ColList( "X, Factor", MinCol( 1 ), MaxCol( 1 ) )
);
// There isn't a need to unload the values from the Column Dialog
/* Unload the values from the Column Dialog */
/*my_Y1 = cdlg["yCol"][1];
my_Y2 = cdlg["yCol"][2];
my_Y3 = cdlg["yCol"][3];
my_Y4 = cdlg["yCol"][4];
my_Y5 = cdlg["yCol"][5];
my_Y6 = cdlg["yCol"][6];
my_Y7 = cdlg["yCol"][7];
my_Y8 = cdlg["yCol"][8];
my_Y9 = cdlg["yCol"][9];
my_Y10 = cdlg["yCol"][10];
my_Y11 = cdlg["yCol"][11];
my_Y12 = cdlg["yCol"][12];
my_Y13 = cdlg["yCol"][13];
my_X = cdlg["xCol"][1];*/
// What is returned from the ColDialog for yCol is a list of columns in the
// form of expressions, not strings. Control Chart builder does not seem to
// like processing of lists of a length greater than 1. So to get around that
// I take the list and convert it into a single character string. I have found
// the fastest way to do this is to strip off the "{}" from the list leaving
// everything inside of the list as a single string
temp = Substr( Char( cdlg["yCol"] ), 2, Length( Char( cdlg["yCol"] ) ) - 2 );
/* Use the column selections in an analysis */
// Build a character string that is the complete command string
// to run the Control Chart Builder, inserting the above created
// temp variable and then run it.
Eval(
Parse(
"Control Chart Builder(
Show Two Shewhart Charts( 0 ),
Sort by Row Order( 1 ),
Connect Thru Missing( 1 ),
Variables(
Subgroup(eval(cdlg[\!"xCol\!"])),
Y("
|| temp ||
")),
Chart(
Points( Statistic( \!"Individual\!" ) ),
Limits( Sigma( \!"Levey Jennings\!" ) ),
Process Capability Analysis(
Within Sigma Capability( 0 ),
Histogram( 1, Show Within Sigma Density( 0 ) )
)
));"
)
);
;Grazie - è geniale.
Non ci sarei mai arrivato da solo
So che questa è una richiesta piuttosto semplice, ma sono nuovo nella programmazione e sono rimasto un po 'perplesso all'ultimo incontro.
Ho scritto un componente aggiuntivo per i nostri ingegneri della qualità per prendere i dati in una tabella, dividere la tabella, aggiungere specifiche e limiti di controllo da un'altra tabella e poi voglio che abbiano i grafici di controllo da creare per loro - o semplicemente avere una finestra di dialogo per selezionare le colonne o tutte le colonne numeriche/continue vengono tracciate.
Il problema è che i nomi e il numero di colonne varieranno ogni volta poiché dipende dal prodotto e desidero un componente aggiuntivo generico.
Questo è l'ultimo bit di codice che mi preoccupa: posso farlo funzionare con un numero prescritto di colonne (13 in questo caso) ma voglio che sia un numero qualsiasi.So di aver bisogno di un paio di semplici righe di codice, ma non riesco a capirlo.Qualsiasi aiuto apprezzato.
/* Query the user for X and Y columns */
cdlg = Column Dialog(
yCol = ColList( "Y, Response", MinCol( 1 ), MaxCol( 25 ), Data Type( "Numeric" ) ),
xCol = ColList( "X, Factor", MinCol( 1 ), MaxCol( 1 ) )
);
/* Unload the values from the Column Dialog */
my_Y1 = cdlg["yCol"][1];
my_Y2 = cdlg["yCol"][2];
my_Y3 = cdlg["yCol"][3];
my_Y4 = cdlg["yCol"][4];
my_Y5 = cdlg["yCol"][5];
my_Y6 = cdlg["yCol"][6];
my_Y7 = cdlg["yCol"][7];
my_Y8 = cdlg["yCol"][8];
my_Y9 = cdlg["yCol"][9];
my_Y10 = cdlg["yCol"][10];
my_Y11 = cdlg["yCol"][11];
my_Y12 = cdlg["yCol"][12];
my_Y13 = cdlg["yCol"][13];
my_X = cdlg["xCol"][1];
/* Use the column selections in an analysis */
Control Chart Builder(
Show Two Shewhart Charts( 0 ),
Sort by Row Order( 1 ),
Connect Thru Missing( 1 ),
Variables(
Subgroup(my_X ),
Y(my_Y1,my_Y2,my_Y3,my_Y4,my_Y5,my_Y6,my_Y7,my_Y8,my_Y9,my_Y10,my_Y11,my_Y12,my_Y13)),
Chart(
Points( Statistic( "Individual" ) ),
Limits( Sigma( "Levey Jennings" ) ),
Process Capability Analysis(
Within Sigma Capability( 0 ),
Histogram( 1, Show Within Sigma Density( 0 ) )
)
));