Hi,
There doesn't seem to be a transformer that exactly fits to your requirement. But the Tester with a test condition like "attr =" (right value is blank) can test whether "attr" is Empty or Null or Missing, since = operator doesn't distinguish the trio. Even though there are 20+ attributes to be tested, I don't think setting 20+ conditions in a Tester is so troublesome.
If a more flexible way (easier to set/change target attributes) is required, I would create a custom transformer wrapping a simple Tcl script.
The implementation would be:
- Create a published parameter. Type: Attribute List (space delimited).
- Fetch the parameter value - i.e. a string containing space delimited attribute names with a ParameterFetcher to save it as an attribute. e.g. named "_attrs".
- Add a TclCaller to check if one of the attributes contains Empty or Null, or is Missing. This procedure example returns 1 if an attribute is empty or null or missing; otherwise returns 0.
-----
proc checkEmptyNullMissing {} {
foreach attr [FME_GetAttribute "_attrs"] {
if {[string equal [FME_GetAttribute $attr] {}]} {
return 1
}
}
return 0
}
-----
- Route the feature to different output port according to the result.
Naturally Python can also do the same thing, but I think Tcl is easier since space delimited attribute names can be treated directly as a list for the iteration.
One more.
If you rename the attributes so that those can be populated into a list using the ListPopulator or the ListExpressionPopulator, you can create a list containing the attribute values, and then the ListSearcher can be used to check if the list contains a specific value.
Takashi