Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I'm trying to create a Job that reads from a table and automatically converts any Float type field into Integer type, so that I can create a File with no float data type fields (just Integers).
I came across this option, in File -> Edit Project properties:
I've noticed this in my tMap component:
My question to you is the following: Can I do this, without explicitly mentioning which fields I want converted? Is this the way I go about converting ANY Float field into an Integer?
Please help me.
Thank you so much,
Rui
Hi
The auto-conversation of types is only available from tMap between the columns in input table and output table, as seen below.
You need to add the column in the output table and specify the column from input table in the expression field.
Regards
Shong
Hello @Shicong Hong , good morning.
Thank you for replying.
Is there anything else I must do in this screen so that tMap works as you mentioned?
Do I need to add a Conversion Function? If so, how?
Normally, when I use a conversion function, I need to specify the fields. Here I don't see how I can do that.
Thank you,
Rui
Hi Rui
You don't need to add a Conversion Function unless you want to override the default conversion function using a customized function. You just need to check the 'enable Auto-conversion of Types box on the Properties settings panel of tMap.
Drag and drop the field from the input table to output table, change the Type from Float to Integer. see the image in my previous post.
Regards
Shong
Hello @Shicong Hong ,
Thank you for replying.
I was able to create these conversions:
The default conversion function I get when I add a new line is always the same:
String.valueOf(${0})
And it does not change, no matter what type I choose in the Source or Target fields. So I have to write the conversion function, according to the Source and Target types.
Float --> String --> Integer is the way I found to transform from Float to Integer.
Thanks,
Rui