Segnalazione di un errore se il nome della variabile non corrispondeCiao a tutti,
Voglio creare una semplice trappola di errori in cui contrassegnerà l'errore se il nome della variabile dal nome della variabile definito dall'utente con il nome della variabile della tabella esistente. Ad esempio come di seguito;
Tabella dati definita dall'utente
Nome variabile
1. Benzene
2. Metano
3. Etano
Tabella dati esistente
Nome variabile
1. Benzene
2. Metano
3. Etano
4. Propano
5. Pentano
6. Esano
Ho provato a usare la funzione !contains, ma sembrava che non usassi la sintassi correttamente. Sono molto nuovo nello script jmp, quindi sto cercando qualcuno nella comunità di aiuto
Inputdt = User Defined Data Table Name
mvdt = Existing Data Table Name
//Get required variable lists from user define Data Table
varListInput = Column( Inputdt, "Variable Name" ) << get values;
// Error trap - if # UserDefinedTable & # Existing Data Table variables don't match, then break code & output error message.
//Obtain column names from existing Data Table from list
colnames = mvdt << get column names( string );
show(colnames);
show(varListInput);
If(!contains Item ("colnames", "varListInput"),
Message = Dialog( "The Variable Name does not match with Existing Data Table.Please correct your Input Table." );
Stop();
);SceneggiaturaRe: Segnalazione di un errore se il nome della variabile non corrispondeLa funzione Contains Items() richiede che i dati siano in array associativi.Se i tuoi articoli sono negli elenchi, il metodo seguente funzionerà.
Inputdt = User Defined Data Table Name
mvdt = Existing Data Table Name;
//Get required variable lists from user define Data Table
varListInput = Column( Inputdt, "Variable Name" ) << get values;
// Error trap - if # UserDefinedTable & # Existing Data Table variables don't match, then break code & output error message.
//Obtain column names from existing Data Table from list
colnames = mvdt << get column names( string );
show(colnames);
show(varListInput);
For( i = 1, i <= N Items( varListInput ), i++,
If( !Contains( colnames, varListInput[i] ),
Message = Dialog(
"The Variable Name does not match with Existing Data Table.Please correct your Input Table."
);
Stop();
)
);