Skip to main content
Question

Terminate workspace if a reader doesn't contain any features?

  • August 14, 2013
  • 7 replies
  • 187 views

jon
Contributor
Forum|alt.badge.img+5
  • Contributor
I'm relatively new to FME and love it so far but need a little guidance.  I'm developing workspaces using a custom reader that reads an object oriented file.  I never know what features I'm going to receive in the file and want to add some error handling in the begining of the process by testing to see if any features exist - if not, terminate.  I've tried adding a counter and a terminator to the reader but no features exist so I never get a number from the counter.   The workbench continues running since I have other readers (that do have features).   How do I terminate the workspace if a certain reader doesn't contain any features?  

7 replies

tomf
Contributor
Forum|alt.badge.img+14
  • Contributor
  • August 15, 2013
You can use the transformer NoFeaturesTester and Terminator.

 

 

Tom

jon
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • August 15, 2013
Tom - thanks for your help.  I tried out using the NoFeaturesTester and Terminator (which works great) but the rest of the workbench continues to run since I have other readers that do contain features.  How do I make the workbench terminate in the begining on a particular reader so it doesn't run the rest of the translation?  Does that make sense?

takashi
Evangelist
  • August 15, 2013
Hi Jon,

 

 

I suppose that you applied NoFeaturesTester + Terminator to every reader feature type in the workspace.

 

However, since the Workbench reads the source datasets in the order of the tree nodes shown on the Navigator window, the process starting from the upper dataset will be continued even if there are no features in the lower dataset.

 

I guess you encountered such a situation.

 

 

You can modify the order of the tree nodes (datasets) by drag-and-drop or right-click a node. But I don't think it's possible to stop the process starting from the upper dataset before the lower dataset causes terminating.

 

 

Takashi

 


nic_ran
Contributor
Forum|alt.badge.img+16
  • Contributor
  • August 15, 2013
Use your custom reader for the object oriented file dataset and then use the FeatureReader transformer for the subsequent datasets. The FeatureReader requires an input feature to tell it to do something, so it will only read features if your initial reader had data.

tomf
Contributor
Forum|alt.badge.img+14
  • Contributor
  • August 15, 2013
The FeatureReader read the data for every INITIATOR, so the data is duplicated.

 

 

Another way:

 

 

A small Workbench that checks empty Input und call the full Workbench (WorkspaceRunner).

farfar
Contributor
Forum|alt.badge.img+11
  • Contributor
  • August 16, 2013
Hi,

 

you can use the Directory and File Pathnames format  off reader and specify the path filter (example : *.shp). 

 

if file with this extension exists into a directory the traitment launches. If there is no file, no traitment starts.

 

 

Farfar

jon
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • August 23, 2013
I ended up using a NoFeaturesTester and FeatureReader.  The inititator for the FeatureReader came from the Input from the NoFeaturesTester.  The NoInput port calls a terminator.

 

 

Thanks for everyones help!

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