Ciao,
Ho un set di dati originale (table1) e sto cercando di scriverlo nel risultato nella tabella 2.
Se qualsiasi numero è inferiore a 300, stamperà la stringa "type1" nella colonna "result1".
Se un numero è superiore a 300, verrà stampata la stringa "type2" nella colonna "result2".
| Numero | tipo 1 | tipo2 | risultato1 | risultato2 |
| 100 | a1 | a2 | | |
| 200 | b1 | b2 | | |
| 150 | c1 | c2 | | |
| 275 | d1 | d2 | | |
| 555 | e1 | e2 | | |
| 424 | f1 | f2 | | |
| 572 | g1 | g2 | | |
| 783 | h1 | h2 | | |
| 125 | i1 | i2 | | |
Tabella 1: dati originali
| Numero | tipo 1 | tipo2 | risultato1 | risultato2 |
| 100 | a1 | a2 | a1 | |
| 200 | b1 | b2 | b1 | |
| 150 | c1 | c2 | c1 | |
| 275 | d1 | d2 | d1 | |
| 555 | e1 | e2 | | e2 |
| 424 | f1 | f2 | | f2 |
| 572 | g1 | g2 | | g2 |
| 783 | h1 | h2 | | h2 |
| 125 | i1 | i2 | i1 | |
Tabella2: Risultato
Finora, quello che ho fatto sul mio script è mostrato di seguito.
dt = tabella dati corrente(); dt << new column( "result1", Character, "Nominal", For each row(If (:Number << 300), :result1 == :type1, "") );<BR /><BR /> dt << new column( "result2", Character, "Nominal", For each row(If (:Number >> 300), :result2 == :type2, "") );