Problema con la selezione della tabella datiCiao,
Spero tu stia bene.
Questo è un codice molto lungo e non ottimizzato per eseguire 2 sottoinsiemi da due diversi set di dati ("CL e Spec" e "Set di dati"). C'è una casella di testo per scegliere quali righe selezionare in base ai livelli dei set di dati.
Tuttavia, il problema è che dopo l'esecuzione del sottoinsieme della prima tabella di dati (set di dati denominato "CL e Spec"), il sottoinsieme del secondo set di dati (denominato "Set di dati") non funziona senza alcun messaggio di errore. Non c'è proprio nessun sottoinsieme che viene eseguito. La mia comprensione è che c'è un problema con il mio modo di selezionare il set di dati da selezionare per il sottoinsieme. Oppure non ho utilizzato correttamente la funzione "Tabella dati correnti".
Ecco il mio codice:
dt2 = Data Table( "CL and Spec" );
Current Data Table( dt2 );
// get unique values from the strength column
Summarize( dt2, levels = by( :Product ) );
// construct a window containing checkboxes
New Window( "Selection",
modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ),
V List Box(
Text Box( "Select values:" ),
here:cb = Check Box( levels ),
Spacer Box( size( 0, 20 ) ),
Button Box( "Create Subset", doSubset() )
)
)
);
// define function to perform when button is cliccked
doSubset = Function( {},
{default local},
dt2 = Current Data Table();
dt2 << clear select;
// get user selections
selected = here:cb << get selected;
// iterate over each of the selected values
// and select the associated rows
For( i = 1, i <= N Items( selected ), i++,
rows = dt2 << select where( :Product == selected[i], current selection( "extend" ) )
);
// create a subset table
dt2 << subset( selected rows( 1 ), selected columns only( 0 ) );
dt2 << clear select;
);
// Define the control and specification limits
LSL = dt2:LSL[1];
USL = dt2:USL[1];
dt = Data Table( "Data Set" );
Current Data Table( dt );
// get unique values from the strength column
Summarize( dt, levels = by( :Strength ) );
// construct a window containing checkboxes
New Window( "Selection",
modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ),
V List Box(
Text Box( "Select values:" ),
here:cb = Check Box( levels ),
Spacer Box( size( 0, 20 ) ),
Button Box( "Create Subset", doSubset() )
)
)
);
// define function to perform when button is cliccked
doSubset = Function( {},
{default local},
dt = Data Table( "Data Set" );
Current Data Table( dt );
dt << clear select;
// get user selections
selected = here:cb << get selected;
// iterate over each of the selected values
// and select the associated rows
For( i = 1, i <= N Items( selected ), i++,
rows = dt << select where( :Strength == selected[i], current selection( "extend" ) )
);
// create a subset table
dt << subset( selected rows( 1 ), selected columns only( 0 ) );
dt << clear select;
);Spero che la mia domanda e il mio problema siano espressi chiaramente;)
Grazie mille per l'aiuto e buona giornata!
Jean
ScriptingRi: problema con la selezione della tabella dei datiNon ho le tue tabelle, ma è così che affronterei un problema simile:
Names Default to Here( 1 );
dt2 = Data Table( "CL and Spec" );
// get unique values from the strength column
levels = Associative Array( dt2:product ) << Get Keys;
// construct a window containing checkboxes
continue = 0;
New Window( "Selection",
<<MODAL></MODAL>
Ri: problema con la selezione della tabella dei datiIn effetti la mia preoccupazione è che voglio aprire 2 diversi set di dati e utilizzare i dati del primo, quindi passare a quello successivo.
Ho utilizzato la funzione "Tabella dati correnti" prima di eseguire il sottoinsieme.
Una prima parte del codice consiste nel caricare il set di dati "CL e Spec", aprire una casella di testo, creare un sottoinsieme di una riga del set di dati "CL e Spec" e memorizzare i parametri "LSL" e "USL" nel LSL e variabili USL. Quindi il set di dati "CL e Spec" non viene più utilizzato.
Names Default to Here( 1 );
dt2 = Data Table( "CL and Spec" );
// get unique values from the strength column
levels = Associative Array( dt2:product ) << Get Keys;
// construct a window containing checkboxes
continue = 0;
New Window( "Selection",
<<MODAL></MODAL>
Quindi la seconda parte del codice consiste nel caricare il set di dati "Set di dati", aprire una casella di testo e creare sottoinsiemi di righe del set di dati "Set di dati".
dt = Data Table( "Data Set" );
Current Data Table( dt );
// get unique values from the strength column
Summarize( dt, levels = by( :Strength ) );
// construct a window containing checkboxes
New Window( "Selection",
modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ),
V List Box(
Text Box( "Select values:" ),
here:cb = Check Box( levels ),
Spacer Box( size( 0, 20 ) ),
Button Box( "Create Subset", doSubset() )
)
)
);
// define function to perform when button is cliccked
doSubset = Function( {},
{default local},
dt = Data Table( "Data Set" );
Current Data Table( dt );
dt << clear select;
// get user selections
selected = here:cb << get selected;
// iterate over each of the selected values
// and select the associated rows
For( i = 1, i <= N Items( selected ), i++,
rows = dt << select where( :Strength == selected[i], current selection( "extend" ) )
);
// create a subset table
dt << subset( selected rows( 1 ), selected columns only( 0 ) );
dt << clear select;
);Tuttavia, i secondi dati non vengono caricati o non ci sono sottoinsiemi delle righe...
Grazie mille per il tuo aiuto!