Heya,
I have a graph I’m running with CloverETL egnine v3.3.0 and I’m coming across an issue.
I use the following code to set a field value:
if (value instanceof String) {
BigInteger tempInt = TransformUtil.getValidBigInteger(value.toString());
if (tempInt != null) {
SetVal.setInt(dataRecord, fieldName,tempInt.intValue());
}
}
In this case, the value is “19653346”
If my FMT has the field defined as:
<Field name="q3_val" type="numeric" nullable="true" size="15" format="##########" />
the value in my output file is 19653346
If my FMT has the field defined as:
<Field name="q3_val" type="numeric" nullable="true" size="15" />
the value in my output file is 1.9653346E7
I’ve tried a couple other SetVal methods (setLong(), setString()) and without the format string I always seem to get “1.9653346E7.” Is this expected behaviour or is there a way for me to get the output value to be 19653346 without having to set the format string?
Thanks,
Anna
Hi, Anne,
numeric type is not officialy supported in our products, we have number type instead. See http://doc.cloveretl.com/documentation/ … types.html
But generally speaking, in numeric type, format has to be set to meet your request. When you save your number as numeric, it is stored in scientific notation internally so if you want to display it somehow else, you have to set format.
If you do not want to display the number in scientific notation, you can just use integer or long instead of numeric in metadata.
Best regards,
Heya,
Thank you for your reply. We’ve been using Clover since 2007, so it looks like our use of numeric has been deprecated: http://wiki.clovergui.net/doku.php?id=g … s:metadata. I will switch to number to see if it makes a difference.
The problem I have is the incoming data is not necesarily integer - there might be decimals in some of the values and I do not know how many places the data may be. That means I cannot set a specific format string, correct? From what you are saying below, it sounds like I would have to have the metadata type as String in order to force the data to not be in scientific notation?
Thanks,
Anna
Hello again,
there is a possibility to store the numbers as decimal without scientific notation. I am attaching a sample graph. decimal.grf Important is to keep the input number as string and then transform it to decimal. If you try to store some number as decimal directly, the number will be truncated in some point and filled with zeros. So you could loose a part of information otherwise. Also set length and scale of decimal high enough to be able to process all input numbers.
Unfortunately, there is no option to have “elastic” size of decimal according to input numbers so the “shorter” numbers will always contain appropriate number of zeros.
Best regards,