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
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
You should dump the value directly to the console (in tJavaRow e.g.: System.out.println(out1.Value)
to see exactly what it looks like with different conversions applied so you can determine exactly where the problem is.
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
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