Skip to main content
Question

What is the best way to subtract attributes and test the result?

  • February 19, 2018
  • 8 replies
  • 269 views

Forum|alt.badge.img

Hello,

I'm new to FME and trying to find my way around and could use a little help. I'm trying to subtract one attribute from another and test that it is above one value and below another. My thought was to use the arithmetic editor in the Tester translator, however, the items that pass are not correct. Below is a screenshot of what I'm trying to do but the results appear to be the opposite and have a result value greater than 1000. What am I doing wrong?

Thanks!

8 replies

david_r
Evangelist
  • February 19, 2018

Are you sure that every feature has a value for both "2016 Assessed Value" and "2015 Assessed Value"?

I just tried the following and it worked as expected:


Forum|alt.badge.img
  • Author
  • February 19, 2018

Thanks for the reply David, no not all features have a value but I thought the @sub function was able to handle empty features? And for the few that "passed" the test why is the result greater than 1000? Thanks again!

,

Thanks for the reply David, no not all features have a value but I thought I read that the @sub function was suppose to handle empty features? And for the few that did pass the test, why is the result greater than 1000? Thanks again!


david_r
Evangelist
  • February 19, 2018
raybouldrob wrote:

Thanks for the reply David, no not all features have a value but I thought the @sub function was able to handle empty features? And for the few that "passed" the test why is the result greater than 1000? Thanks again!

,

Thanks for the reply David, no not all features have a value but I thought I read that the @sub function was suppose to handle empty features? And for the few that did pass the test, why is the result greater than 1000? Thanks again!

I couldn't tell without seeing the data. Can you post a minimal workspace with data to reproduce here?

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 19, 2018
raybouldrob wrote:

Thanks for the reply David, no not all features have a value but I thought the @sub function was able to handle empty features? And for the few that "passed" the test why is the result greater than 1000? Thanks again!

,

Thanks for the reply David, no not all features have a value but I thought I read that the @sub function was suppose to handle empty features? And for the few that did pass the test, why is the result greater than 1000? Thanks again!

The @sub function returns <null> if the input value is not a numeric, and the Tester determines that <null> is less than any number, with <, <=, >=, > operators. See also the description about the Operators in the help on the Tester.

 

 


Forum|alt.badge.img
  • Author
  • February 20, 2018

Here is a workspace and some data. I'm trying to narrow down the list to the features that have a result of 2016 assessment subtract 2015 assessment greater than 1 and less than 1000. I did the calculation in excel and have a column showing that I should only have 3 features pass the test. Instead I have 18 and none of which are the 3 I would expect. Let me know your thoughts.

Thanks!

example-data.xlsxsub-example.fmw


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 20, 2018
The original values of 2016/2015 Assessed Value are strings containing thousand separator (comma), but FME seems to consider the values as numbers containing decimal places. e.g. "191,400" will be treated as "191.4". The behavior may be reasonable since the comma is used as decimal point in some regions in the world, but I think that it should be documented somewhere in the help.

 

Try removing commas from the original values before performing math operations.

 

 


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 20, 2018
raybouldrob wrote:

Here is a workspace and some data. I'm trying to narrow down the list to the features that have a result of 2016 assessment subtract 2015 assessment greater than 1 and less than 1000. I did the calculation in excel and have a column showing that I should only have 3 features pass the test. Instead I have 18 and none of which are the 3 I would expect. Let me know your thoughts.

Thanks!

example-data.xlsxsub-example.fmw

The original values of 2016/2015 Assessed Value are strings containing thousand separator (comma), but FME seems to consider the values as numbers containing decimal places. e.g. "191,400" will be treated as "191.4". The behavior may be reasonable since the comma is used as decimal point in some regions in the world, but I think that it should be documented somewhere in the help.

 

Try removing commas from the original values before performing math operations.

 

 


Forum|alt.badge.img
  • Author
  • February 21, 2018
takashi wrote:
The original values of 2016/2015 Assessed Value are strings containing thousand separator (comma), but FME seems to consider the values as numbers containing decimal places. e.g. "191,400" will be treated as "191.4". The behavior may be reasonable since the comma is used as decimal point in some regions in the world, but I think that it should be documented somewhere in the help.

 

Try removing commas from the original values before performing math operations.

 

 

That was the answer, thanks takashi!

 

 


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