Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
SV1605718563
Contributor
Contributor

Getting Boolean instead of integer in tmap, help needed

Hello Team,

Just downloaded Talend Big data community version into my laptop and trying to do even and odd number printing to tlogrow.

  1. added trowgenerator to the job
  2. added tmap
  3. added tlogrow-one for odd-one for even....later I would like to make it as one tlogrow.

The job is as below

0693p00000AU8QsAAL.png

In trowgenerator, created a column sq_id as integer with function numeric.sequence

in tmap, I am trying to use the mod function to get divisable as 1 or 0 to identify it as even or odd....the image is as below

I am getting error saying , type mismatch, cannot convert from boolean to integer

can someone help me here how to handle this?

0693p00000AU8TDAA1.png

Thanks

SV

Labels (3)
1 Solution

Accepted Solutions
Prakhar1
Creator III
Creator III

You are writing expression in the value field of tMap.

Mathematical.MOD() == 1 will return true or false which is a Boolean value and you are trying to assign it on seq_id which is a integer.

You have to write this MOD() function in the filter condition on tMap on the top of output.0693p00000AUHDiAAP.png 

View solution in original post

5 Replies
Anonymous
Not applicable

Hi

Can you paste the expression in the post?

 

Regards

Shong

Prakhar1
Creator III
Creator III

You are writing expression in the value field of tMap.

Mathematical.MOD() == 1 will return true or false which is a Boolean value and you are trying to assign it on seq_id which is a integer.

You have to write this MOD() function in the filter condition on tMap on the top of output.0693p00000AUHDiAAP.png 

SV1605718563
Contributor
Contributor
Author

Hi @Shicong Hong​ ...I am able to fix this by assign the expression to a variable and it worked.

here is the expression: row1.sq_id%2==0?row1.sq_id+"-even":row1.sq_id+"-odd" ....thanks for your help.

SV1605718563
Contributor
Contributor
Author

HI @prakhar dubey​ ....I will try your way also....I am able to fix this by assign the expression to a variable and it worked. here is the expression: row1.sq_id%2==0?row1.sq_id+"-even":row1.sq_id+"-odd" ....thanks for your help.

SV1605718563
Contributor
Contributor
Author

This incident is closed...thanks to all