Skip to main content
Solved

Check if field exists and fme_data_type

  • November 11, 2013
  • 5 replies
  • 291 views

Hello all,

 

 

I am being sent a large number of ESRI file geodatabases.  Within these I need to:

 

 

1) check if the individual feature classes contain a specific field (this field, e.g. [Field_x]), should be contained in all feature classes so can be a generic test accross all feature classes).

 

2) secondly I need to check the fme_data_type, this should always be Integer

 

 

I am first trying to test this on one field - however I will have a lot more to test and will need to add and remove more tests over time.

 

 

Can anyone help on how to achieve this?

 

 

I have loaded the .gdb into FME using the "Schema (Any Format)" translator and I can see the values I need to test agains recorded in the attribute{}.fme_data_type and attribute.{}name attributes - I just can't work out how to test them!

 

 

Any help would be very much appreciated.

 

 

Regards,

 

 

Kevin

 

 

P.S. I am happy to share models/data etc if easier - however it is only the second time I have posted on this forum so not sure if this is possible (I cannot see an "attach" item option?)

Best answer by fmelizard

Hi Kevin,

 

 

I do hope that you are using workbench for the testing and that the translator is a typo!

 

Since these attributes are returned as a list, you can search for your attribute name wth the ListSearcher.

 

Set the list attribute to: attribute{}.name

 

Search for: Field_X

 

Search type: First Exact Match

 

check the Demote Found List Element box and fillin a prefix (tested_)

 

 

Now its just a matter of testing (Tester\\TestFilter) the tested_fme_data_type for integer.

 

Hope this helps,

 

Itay

 

 

p.s. for searching on multiple attribute names add some more ListSearchers or use the First regular expression match search type.
View original
Did this help you find an answer to your question?

5 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • Best Answer
  • November 11, 2013
Hi Kevin,

 

 

I do hope that you are using workbench for the testing and that the translator is a typo!

 

Since these attributes are returned as a list, you can search for your attribute name wth the ListSearcher.

 

Set the list attribute to: attribute{}.name

 

Search for: Field_X

 

Search type: First Exact Match

 

check the Demote Found List Element box and fillin a prefix (tested_)

 

 

Now its just a matter of testing (Tester\\TestFilter) the tested_fme_data_type for integer.

 

Hope this helps,

 

Itay

 

 

p.s. for searching on multiple attribute names add some more ListSearchers or use the First regular expression match search type.

  • Author
  • November 11, 2013
Thanks Itay - works exactly how I wanted.

 

 

Extending on this further if I already have a schema that I want to test the incoming data against is there a way to do this?  I have a master schema that I would like to test against but wanted to take one step at a time (especially as I am new to FME!).

 

 


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • November 11, 2013
Hi,

 

Have a look at the schema mapper, in it you can define your master schema and test the incoming features against it.

 

Itay

takashi
Influencer
  • November 11, 2013
Hi Kevin and Itay,   I also think the ListSearcher of "First regular expression match" type would be effective, but that has a bug unfortunatly. See this FMEpedia article: ListSearcher cannot handle the regular Expression "^1$|^9$|^10$" For your information.   > I cannot see an "attach" item option? There is not item attaching option. If you upload items to an external server (you can use some free servers like Dropbox etc.) and paste the URL here, then we can refer them.

 

 

Takashi

tim_wood
Contributor
Forum|alt.badge.img+8
  • Contributor
  • January 13, 2017

I've just had a similar requirement for checking fields exist in a CSV file and have solved it using AttributeValidator. Under Attributes to Validate, select the fields you want to check exist (in my case I selected all fields). Under Validation Rule select "Has a Value".

If features come out of the "Passed" port, you know it's OK. If they come out of the "Failed" port you can act accordingly e.g. log the problem features, send an email, terminate the Workspace.

I guess this won't necessarily work for all Readers, for example the Excel Reader with "Read blank cells as" set to Null.


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