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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
tYrannoSaurusRex_1
Contributor III
Contributor III

issue with percentage values

hi,
I am getting below error when transferring values in db.
the method replace(string, string, string) in the type String Handling is not applicable for the arguments (integer, string, string) talend
Input is excel, value is 100%. Target column has integer as data type and input has integer as data type.
In expression builder tried StringHandling.EREPLACE(row1.average_rate,"%","0")
Tried tReplace, but still nothing happened.
to explain problem in short,
values for average_rate in excel sheet is in percentage,
100.00%
90.00%
and so on
What output should be is,
100
90 and so on
datatype in database is integer.....
Labels (2)
3 Replies
Anonymous
Not applicable

If it's telling you that the first parameter you're passing is an integer, then it sounds like you have no "%" character to remove - as it's not a String.
Try using a tLogRow to display the data that is actually coming from your spreadsheet. Maybe there's nothing for you to do?
willm1
Creator
Creator

@tal00000 - Agreed...
Else you can do a .toString() before doing the Replace...
Anonymous
Not applicable

Hi,
Your input is a string, first replace %--> convert it to float --> convert it to integer as below
output_row.average_rate = (int)(Float.parseFloat(StringHandling.EREPLACE(row1.average_rate,"%","0")));
This will give you output as 100 which is of integer datatype.
Thanks
Vaibhav