Skip to main content
Question

Best practice for checking attribute values


torbjornd
Contributor
Forum|alt.badge.img+4

I'm working with a workbench which is supposed to check if several attribute values ( five attributes) exceeds a limit (each attribute has its own limit). I'm using an sqlexecutor to get the feature and one for getting the limits. If one of the values exceeds the limit I want to write the name of the attribute and value to a string variable. I've tried using a testfilter (5 testqueries) connected to an attributecreator and stringconcatenator, but this doesn't seem to work since I only have one feature on the testfilter input.

Does anyone have a good solution for this?

7 replies

david_r
Celebrity
  • April 29, 2016

Hi

Have you considered the AttributeValidator that was introduced in FME 2016?

David


Forum|alt.badge.img
  • April 29, 2016

Attribute Manager conditional statements are good as well. Basically if you have a database that is centered around the use of drop down lists or there is a finite amount of acceptable values in a column then you can use if statements to check that all values are acceptable, if not then do nothing/change to null/flag it or set a default value for it. AttributeValidator is fantastic for checking exactly why a validation was failed, I believe the transformer creates a column _fme_validation_message. And it states why a record failed and exactly WHERE it failed, which is invaluable for troubleshooting validation problems. Hope this helps :)


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • April 29, 2016

The TestFilter is using an If .. Elsif..Else construction.

So if the first test passes the other tests will not be executed.

If your feature fails all conditions only one output will be shown.

If you need all tests to be performed I would go with 5 Testers and connect the Passed port (Value > limit) to an AttributeCreator and route both streams to the next Tester.

This way all tests are performed and possibly 5 result attributes are created.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • April 29, 2016

i would go for a attributecreator ( manager in 2016 i believe).

Either use conditional creation (as stated by Rycharge) or use expression or regexp. to do that.


takashi
Influencer
  • April 29, 2016

Hi @torbjornd, if you are looking for a way to merge the limit values to the features from the SQLExecutor, the FeatureMerger might help you. You can set an identical constant (e.g. 1) to the "Join One" parameter for both Requestor and Supplier, to merge Supplier's attributes to Requestors unconditionally.


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • April 29, 2016

I would go with the AttributeManager using conditional functionality. You don't want a "filter" transformer because you want to just test/set values, not filter the data. You really need a "mapper" transformer. The AttributeRangeMapper would probably work here, but in general we need to implement a mapper transformer that is similar to the conditional tools, but easier to find/understand.


torbjornd
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • May 12, 2016
rycharg wrote:

Attribute Manager conditional statements are good as well. Basically if you have a database that is centered around the use of drop down lists or there is a finite amount of acceptable values in a column then you can use if statements to check that all values are acceptable, if not then do nothing/change to null/flag it or set a default value for it. AttributeValidator is fantastic for checking exactly why a validation was failed, I believe the transformer creates a column _fme_validation_message. And it states why a record failed and exactly WHERE it failed, which is invaluable for troubleshooting validation problems. Hope this helps :)

Thank you. I've tried using the AttributeValidator, but that transformer throws an error when I'm using a attribute value as "upper limit value". If I manually set the limit, it works. This is the error-message:

Illegal operator `RANGE' supplied for test evaluation -- operator must be one of < > <= >= != = ==


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