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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Decimal nuber format

Hi everyone,
I am having problem to convert number which is taken from excel as string and during my mapping I have converted to Big decimal as need it to get rid of commas ...
On the end when I am outputting this value in my xml I am having number in format 1.197803E+7.
I had try to change again to string and make to be as normal number using this method but still not have any luck.
out1.Value.toString().contains(".") ? out1.Value.toString() : out1.Value.toString() + ".000000000001"
Is anyone know the easy way to get real number or method how I will do this.
Thanks
Zeljka
Labels (3)
8 Replies
Anonymous
Not applicable
Author

Hi
What's the real value looks like in excel? What's your expected result? Do you check the box 'read real values from number' in the advanced settings tab of tFileInputExcel.
Best regards
Shong
alevy
Specialist
Specialist

You should dump the value directly to the console (in tJavaRow e.g.: System.out.println(out1.Value) 0683p000009MA9p.png to see exactly what it looks like with different conversions applied so you can determine exactly where the problem is.
Anonymous
Not applicable
Author

If your output File XML defines the target field as a string or double column, try switching it to BigDecimal.
Anonymous
Not applicable
Author

I have tried to use as string, double and BigDecimal and output is always same ...
I am bit confused now what can be...
Zeljka
Anonymous
Not applicable
Author

hi everyone,
I have found solution after trying a few things , not sure how briliant is but working at the moment and giving me right output...
new java.text.DecimalFormat("#.############").format(row8.Value.doubleValue())
Zeljka
Anonymous
Not applicable
Author

Hi
try to read the column as string and then convert to double or float
Anonymous
Not applicable
Author

Hi,
If you're having trouble with format and applying conversions throughout your map, consider isolating the conversions using this strategy.
1. Set all of the input Excel fields to "string".
2. Create a File XML with specific types (double, BigDecimal) in the XML output fields.
3. Add a tConvertType, preferably with "Auto Cast", to the input Excel to set the Excel types. Leave "uncastable" values as strings. This step will define a second schema based on the input Excel, but with types.
4. Connect a tMap to apply more complicated conversions that may involve a helper function (TalendDate, etc.). Convert any "uncastable" values in the mapping.
The following link is on working with commas and decimal points in numeric strings.
http://bekwam.blogspot.com/2011/05/different-locales-us-europe-in-talend.html
-Carl
Anonymous
Not applicable
Author

thanks for this tips ...
Z