Skip to main content
Solved

Remove decimal and decimal values without rounding.


katericondo
Contributor
Forum|alt.badge.img+4

Say I have 105.6546 and 5646.546356, how can I drop only the decimal and values to the right of the decimal? So my final values will be 105 and 5646.

Best answer by jdh

Using the arithmetic editor in any of the transformers that create attributes, you can use @int() or @floor().

 

@int will truncate the value, @floor will return the next lowest integer, these are identical for positive values, but will differ by 1 for negative values.

 

@int(10.1) =>10

 

@floor(10.1) =>10

 

@int(-10.1) => -10

 

@floor(-10.1) => -11
View original
Did this help you find an answer to your question?

6 replies

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • March 3, 2017

The ExpressionEvaluator transformer can be used, using the floor function. It will be in the Math section.


katericondo
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • March 3, 2017
erik_jan wrote:

The ExpressionEvaluator transformer can be used, using the floor function. It will be in the Math section.

Hi Erik_jan, it created a new field but all values were null.

 

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • March 3, 2017

Using the arithmetic editor in any of the transformers that create attributes, you can use @int() or @floor().

 

@int will truncate the value, @floor will return the next lowest integer, these are identical for positive values, but will differ by 1 for negative values.

 

@int(10.1) =>10

 

@floor(10.1) =>10

 

@int(-10.1) => -10

 

@floor(-10.1) => -11

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • March 3, 2017
erik_jan wrote:

The ExpressionEvaluator transformer can be used, using the floor function. It will be in the Math section.

You have to set the ExpressionEvaluator to overwrite existing attribue:

 

To get this result:

 

 


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • March 3, 2017

I would use the AttributeSplitter and use the first element of the lists.


takashi
Influencer
  • April 15, 2017

For what it's worth, if the @floor function satisfies your requirement, the AttributeRounder (Decimal Places: 0, Round-off Direction: Down) can also be used. Instead of the @int function, the StringReplacer with this setting works for you.

  • Mode: Regular Expression Replace
  • Text to Replace: (.+)\\..*
  • Replacement Text: \\1

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