Skip to main content
Hi All, i am trying to create some statistcis (records counts) on  10 fields in a table. I dont want to use multipule filters if i can avoid it. 

 

 

I want to find out how many rows in the table have valid values such as

 

ie Depth <> "-99, NULL, BLANK, 0)

 

ie Invert <> "-99, NULL, BLANK, 0, 0.00)

 

ie Diameter <>  "-99, NULL, BLANK, 0,)

 

 

The TestFilter looks promising except the test condtions are If, Else if, Else. I want the test conditions to be  IF, IF, IF.

 

 

ie currenlty the test filter allows

 

IF Depth <> "-99, NULL, BLANK, 0)

 

Else if Invert <> "-99, NULL, BLANK, 0, 0.00)

 

Else Diameter <>  "-99, NULL, BLANK, 0,)

 

 

 

i would like it like

 

 

IF Depth <> "-99, NULL, BLANK, 0)  -- port these to statscalc

 

IF Invert <> "-99, NULL, BLANK, 0, 0.00)  -- port these to statscalc

 

IF Diameter <>  "-99, NULL, BLANK, 0,)  -- port these to statscalc

 

 

is there another way im missing ?

 

 

Many Thanks  

 

 

Steve

 

 

 

 

 

Hi Steve,

 

 

I would use an AttributeCreator and a StatisticsCalculator. (FME 2013 SP1+)   Create three attributes with an AttributeCreator. Attribute Name: _valid_depth Value: Conditional Value (2 Possible Values) If   Pass Criteria: All Tests (AND)   Test Clauses:     Depth  Attribute Exists     Depth  !=  <empty>     Depth  !=  -99     Depth  !=  0   Output Value: Depth (assign original Depth) Else <Do Nothing>   Create "_valid_invert" and "_valid_diameter" with the similar way in the same AttributeCreator.   Connect a StatisticsCalculator. Attributes To Analyze: _valid_depth _valid_invert _valid_diameter   The SUMMARY feature will have these attributes. _valid_depth._numeric_count _valid_invert._numeric_count _valid_diameter._numeric_count These are the numbers of records which contain valid Depth, valid Invert and valid Diameter.

 

 

Takashi
Many Thanks Takashi, Just what i needed!

 

 

Much appreciated for your reply's and wisdom as always.

 

 

 

Thanks Steve
p.s. You can omit these 2 clauses, since the StatisticsCalculator ignores non-numeric value (or empty) when counting records containing numeric value.     Depth  Attribute Exists     Depth  !=  <empty>
i fail to understand why u can't use the testfilter.

 

Because u can add as many else if's as u want (by clicking the add condition +). Increasing the output ports.

 

Having If, Else if, Else if, Else and a creator at the outputport

 

seems the same as having a attributecreator doing conditional's (wich is the same as the testfilter anyway).

 

 

I reckon the creator thing has to do more comparisons then the filter too.
Hi Gio, thanks for your input. 

 

 

From my understanding , if 100 records enter the testfilter then only 100 records can come out. My senario needs lots of If statements indepenly of each other. 

 

 

ie with 100 records read in 

 

 if  FieldA.Value = Blank output those 70 records here

 

 if FieldB.Value = Null output those 80 records here

 

 

the if, else if would only give me 30 records to output in the second if as 70 were "used" in the first if statement. 

 

 

Thanks for your input and looking at my question..

 

 

Steve
i see.

 

But that suggests that records can pass multiple criteria, right? I misunderstood, i see.

 

So if u had 3 tests to perform on all records, u'lld need 3 testers.

 

Thats the same as creating those 3 attributes and entering the feature set in all those 3, afaics.

 

It's more cosmetic then. Less transformers.
In my understanding, the purpose is to get the number of records containing valid Dapth, valid Invert and valid Diameter separately. The StatisticsCalculater can count only records which contain numeric value for every attribute specified as "Attributes To Analyze". In short, my approach is: create attributes containing valid value only, so that the StatisticsCalculator can count valid records for each attribute. No need to test in the workflow. Of course there should be other approaches. But I think that AttributeCreator + StatisticsCalculator is relatively simple solution in this case.

Just came across this when investigating a similar requirement.

Not sure if I'm misremembering but I'm sure the test filter did use to work with multiple if statements rather than if then else perhaps 6/7 years ago. Can anyone else remember?


Why not the "old fashioned" way:

Use 3 Testers (1 for each test) followed by StatisticsCalculators to get the count for each passed test.


Why not the "old fashioned" way:

Use 3 Testers (1 for each test) followed by StatisticsCalculators to get the count for each passed test.

I'm not looking for statistics, I want to reroute features that meet certain conditions down different paths. Multiple testers is fine, just 'messy' :-)

 

 


Just came across this when investigating a similar requirement.

Not sure if I'm misremembering but I'm sure the test filter did use to work with multiple if statements rather than if then else perhaps 6/7 years ago. Can anyone else remember?

Your testfilter should be able to route features with multiple if statements in two ways (which can be combined).

 

 

On a single Test Condition, have multiple Test Clauses and the Pass Criteria be OR.

 

Have multiple Test Conditions with the same Output Port name.
I'm not looking for statistics, I want to reroute features that meet certain conditions down different paths. Multiple testers is fine, just 'messy' :-)

 

 

How do you do, fellow FME user!

Did you find out any less messy solution than multiple Tester?

Wrestling with the same problem, leaning towards python.


Reply