Skip to main content
Question

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

  • January 30, 2017
  • 5 replies
  • 187 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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

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

 

 


takashi
Celebrity
  • 7843 replies
  • 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+18
  • Supporter
  • 1442 replies
  • 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+22
  • Contributor
  • 2179 replies
  • 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
  • 41 replies
  • 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.