Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Guys,
I'm new at Talend and a few days ago i started to migrate some jobs off the SSIS to the talend, and i face some issues when i try to replicate a kind off "derivate column" off the ssis.
For this i'm using the tMap component and build expression, the expression is working without error mensagens, the expression is working in the "test" of the expression builder, but in the tLogRow or in my Output table the result it's not working corretely.
I'm using this expression
First of all, you should never use "==" to compare 2 strings.
Use String.compareTo() or String.equals() instead.
Then you said that when the column Terms_Of_Payment is "N120" the newColumn should show "120" but you never compare Terms_Of_Payment with this value. Base on your extract, I think you want to compare to "NT120", not to "N120".
Your expression should look like this:
"NT120".equals(row3.TERMS_OF_PAYMENT)?"120": "NT90".equals(row3.TERMS_OF_PAYMENT)?"90": "NT75".equals(row3.TERMS_OF_PAYMENT)?"75": "NT60".equals(row3.TERMS_OF_PAYMENT)?"60": "NT30".equals(row3.TERMS_OF_PAYMENT)?"30": "GE69".equals(row3.TERMS_OF_PAYMENT)?"30": "GE37".equals(row3.TERMS_OF_PAYMENT)?"30": "NT45".equals(row3.TERMS_OF_PAYMENT)?"45": "NT00".equals(row3.TERMS_OF_PAYMENT)?"1": "ZFRE".equals(row3.TERMS_OF_PAYMENT)?"0": "NT15".equals(row3.TERMS_OF_PAYMENT)?"15": "Termo de pagamento não registrado"
Try this one and let us know.
First of all, you should never use "==" to compare 2 strings.
Use String.compareTo() or String.equals() instead.
Then you said that when the column Terms_Of_Payment is "N120" the newColumn should show "120" but you never compare Terms_Of_Payment with this value. Base on your extract, I think you want to compare to "NT120", not to "N120".
Your expression should look like this:
"NT120".equals(row3.TERMS_OF_PAYMENT)?"120": "NT90".equals(row3.TERMS_OF_PAYMENT)?"90": "NT75".equals(row3.TERMS_OF_PAYMENT)?"75": "NT60".equals(row3.TERMS_OF_PAYMENT)?"60": "NT30".equals(row3.TERMS_OF_PAYMENT)?"30": "GE69".equals(row3.TERMS_OF_PAYMENT)?"30": "GE37".equals(row3.TERMS_OF_PAYMENT)?"30": "NT45".equals(row3.TERMS_OF_PAYMENT)?"45": "NT00".equals(row3.TERMS_OF_PAYMENT)?"1": "ZFRE".equals(row3.TERMS_OF_PAYMENT)?"0": "NT15".equals(row3.TERMS_OF_PAYMENT)?"15": "Termo de pagamento não registrado"
Try this one and let us know.