Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
RMotta2408
Creator II
Creator II

Reading from table and converting any Float field to Integer

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:

0695b00000nT4ifAAC.png 

I've noticed this in my tMap component:

0695b00000nT4kCAAS.png 

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

Labels (3)
4 Replies
Anonymous
Not applicable

Hi

The auto-conversation of types is only available from tMap between the columns in input table and output table, as seen below.

0695b00000nTBU6AAO.pngYou need to add the column in the output table and specify the column from input table in the expression field.

 

Regards

Shong

RMotta2408
Creator II
Creator II
Author

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?

 0695b00000nTC8pAAG.pngDo 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

 

Anonymous
Not applicable

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.

0695b00000ochUoAAI.pngDrag 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

 

RMotta2408
Creator II
Creator II
Author

Hello @Shicong Hong​ ,

 

Thank you for replying.

I was able to create these conversions:

 

0695b00000ociXjAAI.pngThe 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