Hi,
I think there is no way to check if a source feature contains invalid attribute value before reading all features. A workaround I can think of is:
Separate the source features into valid and invalid with a filter transformer e.g. the AttributeClassifier.
Merge an invalid feature to every valid feature unconditionally with the FeatureMerger.
If every feature is valid, they all will be output from the NotMerged port. Otherwise, they all will be output from the Merged port. Then, connect the writer to the NotMerged port so that the writer will work only if every feature is valid.
Takashi
Sounds like you need the new AttributeValidator, introduced in FME 2016...
David
Absolutely you can do this. You can set up an AttributeClassifier transformer (FME2015 or earlier) and use it to test if an attribute is an integer. Also, if you right-click on the Writer in the Navigator window you have the option to disable it.
What you can't do is have it checked against the Writer schema automatically. For example, if you change the schema to be text instead of integer, you would need to manually set up your tests to match.
Absolutely you can do this. You can set up an AttributeClassifier transformer (FME2015 or earlier) and use it to test if an attribute is an integer. Also, if you right-click on the Writer in the Navigator window you have the option to disable it.
What you can't do is have it checked against the Writer schema automatically. For example, if you change the schema to be text instead of integer, you would need to manually set up your tests to match.
I just filed an enhancement request (PR#65914) to allow the Writer schema to be imported (either manually or automatically) into the AttributeValidator. I think that would be awesome. That way you could check against the Writer schema more easily.
I just filed an enhancement request (PR#65914) to allow the Writer schema to be imported (either manually or automatically) into the AttributeValidator. I think that would be awesome. That way you could check against the Writer schema more easily.
That would be a killer feature :-)
Try running an AttributeClassifier to test (manually) for the correct attribute type immediately after the features are read. Place a FeatureHolder on the Passed port to prevent any features writing until all features pass. Then, put a Terminator on the Failed port. If any of the input features fail, the Terminator will stop the entire translation before any writing occurs (since the translation will not continue until all features are in the FeatureHolder). This will give you a performance hit, but you expect that anyway when doing validation before the rest of the translation.
(You can even customize the message on the Terminator to tell you more information on the failed feature, like an object identifier and the value of the failed attribute.)
That would be a killer feature :-)
Thanks. Our developer must think so too as she has already pencilled it in for 2017! Let's hope it happens!
Absolutely you can do this. You can set up an AttributeClassifier transformer (FME2015 or earlier) and use it to test if an attribute is an integer. Also, if you right-click on the Writer in the Navigator window you have the option to disable it.
What you can't do is have it checked against the Writer schema automatically. For example, if you change the schema to be text instead of integer, you would need to manually set up your tests to match.
Hello,
Yes, AttributeClassifier can do it but I have alot of writers and each have 10 to 15 attributes to each. On the other hand AttributeClassifier is accepting only 1 attribute at a time so it too time consuming to add that many AttributeClassifier's .
As you have said that enhancement has been requested, it is better entire schema is added automatically and option to allow / not allow null values can be added with a tick mark. Transformer can be used at the beginning or end of the translation as well.
This will work as a big tester for input data validation.
Pratap