Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error on tMap expression

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



To see the whole post, download it here
Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

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.

View solution in original post

1 Reply
TRF
Champion II
Champion II

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.