Skip to main content
Question

decimal #s with trailing zeros compared with same #s without trailing zeros

  • January 30, 2017
  • 5 replies
  • 129 views

Forum|alt.badge.img

Hi there, I'm using the UpdateDetector transformer and it's detecting changes with lat/long fields where numerically there's no difference. This is because in one reader (the CVS reader) these two fields have trailing zeros, while in the other reader (an oracle table) they do not. What's the best way to resolve this?

5 replies

Forum|alt.badge.img
  • Author
  • January 30, 2017
Make that CSV reader (not CVS reader):)

 

 


takashi
Influencer
  • January 31, 2017

Hi @ieukcoca, you can cast the internal data type of the attributes from character string to floating point number using the @double function in the ExpressionEvaluator, and then compare it with the value from the Oracle dataset.


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • January 31, 2017

Hi @ieukcoca,

Alternatively you can try the StringFormatter to truncate the CSV values (.2f for 2 decimals) before the comparison.

Hope this helps.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 31, 2017

Another way of doing this would be to create a point geometry from both source lat/long attributes (Setting the CSV attribute types to X-coordinate and Y-coordinate or using the VertexCreator transformer).

The geometry should be the same as both sources will be interpreted as numeric fields.


gmbutler2
Contributor
Forum|alt.badge.img+10
  • Contributor
  • October 27, 2021

One suggestion that could be to use a StringReplacer on the data that has trailing zeroes. Use a Regular Expression Replace and use the Regex "(0+)$" without the quotes. Leave the replacement text field blank and it will drop the trailing zeroes.

 

Another would be to use an AttributeRounder transformer on both sets of data and conform them all to a specific number of digits.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings