Come creare un dt3 con dt1 tutte le righe, più le righe dt2 che non corrispondono alla colonna "Id" con dt1, il risultato mostra solo poche colonne in dt1 e dt2Voglio ottenere il risultato di: confronta dt1 con dt2, se ci sono "Id" non corrispondono, crea una nuova tabella dt3 con dt1 tutte le righe e aggiungi le righe non corrispondenti in dt2 in dt1 e scegli 3 le colonne (nome, lotto, EPval) vengono visualizzate in dt3. molte grazie
dt1 = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "Id", numeric, values( {"11889922", "11776620", "22889955"} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "Name", character, values( {"John", "Joe", "PP"} ) )
);
dt2 = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "Id", numeric, values( {"33888822", "11776620", "22889955"} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "Mgr", character, values( {"J", "H", "P"} ) )
);Tabella datiRi: Come creare un dt3 con dt1 tutte le righe, più le righe dt2 che non corrispondono alla colonna "Id" con dt1, il risultato mostra solo poche colonne in dt1 e dt2grazie per la tua risposta. Ma esegui lo script? Non funziona nel mio PC. Sto usando JMP14, non sono sicuro se sia per questo. il dt3 non si apre
Ri: Come creare un dt3 con dt1 tutte le righe, più le righe dt2 che non corrispondono alla colonna "Id" con dt1, il risultato mostra solo poche colonne in dt1 e dt2A quanto pare, ho inavvertitamente cancellato l'elemento "With" dell'unione. Non sono sicuro di come ho fatto ..... ma .... ecco il codice corretto
/*I Want to get the result of: compare dt1 with dt2, if there are "Id" don't match then create a new table dt3 with dt1 all rows, and add the don't match rows in dt2 into dt1, and pick 3 columns(name, lot, EPval) show out in dt3. thanks a lot */
dt1 = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "Id", numeric, values( {"11889922", "11776620", "22889955"} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "Name", character, values( {"John", "Joe", "PP"} ) )
);
dt2 = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "Id", numeric, values( {"33888822", "11776620", "22889955"} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "Mgr", character, values( {"J", "H", "P"} ) )
);
// I assumed that there
dt3 = dt1 << Join( with(dt2),
By Matching Columns( :Id = :Id ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 1 )
);
Ri: Come creare un dt3 con dt1 tutte le righe, più le righe dt2 che non corrispondono alla colonna "Id" con dt1, il risultato mostra solo poche colonne in dt1 e dt2
Questo è il registro che ancora non funziona. Posso pubblicare un altro esempio per porre questa domanda. SE il secondo esempio funziona, possiamo ignorarlo.
//: * /
dt3 = dt1 << Join (
In base alle colonne corrispondenti (: Id =: Id),
Drop multipli (0, 0),
Includi non corrispondenti (1, 1),
Mantieni l'ordine della tabella principale (1)
);
/ *:
Unione con tabella dati sconosciuta {3}
Ri: Come creare un dt3 con dt1 tutte le righe, più le righe dt2 che non corrispondono alla colonna "Id" con dt1, il risultato mostra solo poche colonne in dt1 e dt2Tutto quello che devi fare è usare
Tabelle ==> Partecipa
e specificare "Includi non corrispondenze" sia per la tabella Principale che per la tabella Con
/*I Want to get the result of: compare dt1 with dt2, if there are "Id" don't match then create a new table dt3 with dt1 all rows, and add the don't match rows in dt2 into dt1, and pick 3 columns(name, lot, EPval) show out in dt3. thanks a lot */
dt1 = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "Id", numeric, values( {"11889922", "11776620", "22889955"} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "Name", character, values( {"John", "Joe", "PP"} ) )
);
dt2 = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "Id", numeric, values( {"33888822", "11776620", "22889955"} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "Mgr", character, values( {"J", "H", "P"} ) )
);
// I assumed that there
dt3 = dt1 << Join( with(dt2),
By Matching Columns( :Id = :Id ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 1 )
);Ri: Come creare un dt3 con dt1 tutte le righe, più le righe dt2 che non corrispondono alla colonna "Id" con dt1, il risultato mostra solo poche colonne in dt1 e dt2Il codice che stai mostrando non è il codice corretto che ho pubblicato. Il codice JOIN corretto è
dt3 = dt1 << Join( with(dt2),
By Matching Columns( :Id = :Id ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 1 )
);