Skip to main content
Question

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

  • Jan 30, 2017 11:31 PM UTC
  • 5 replies
  • 283 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
  • Jan 30, 2017 11:31 PM UTC
Make that CSV reader (not CVS reader):)

 

 


takashi
Celebrity
  • Jan 31, 2017 12:42 AM UTC

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+19
  • Supporter
  • Jan 31, 2017 10:02 AM UTC

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+26
  • Contributor
  • Jan 31, 2017 3:06 PM UTC

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
  • Oct 27, 2021 7:31 PM UTC

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.