Skip to main content
Hello,

 

 

I am working on a dynamic workspace that is supposed to read multiple feature types that are determined at run-time.  These feature types have different WHERE clauses. I am using a process similar to the ones described in the document below.  However, while I can read multiple feature types I cannot find a way to associate each feature type with its own respective WHERE clause.  I am using the feature reader transformer to read any layer I like and the data sources can be separated by a ":" however the transformer takes only one where clause which is applied to all feature types.

 

 

http://fmepedia.safe.com/articles/How_To/Pass-a-List-of-Tables-or-Layers-to-an-FME-Reader-using-Python-Scripted-Parameters

 

 

Any help or ideas are greatly appreciated!

 

 

Regards,

 

 

Nenad K.
Hi Nenad,

 

 

I'm not sure if there is a way to specify different WHERE clause for each feature type dynamically. One possible workaround I can think of is: Assume the workspace processes one feature type at a run-time. Define published parameters for a feature type and a WHERE clause. Create another workspace which can read multiple pairs of  feature type and WHERE clause, and run the main workspace for every feature type one by one. i.e. pass feature type and WHERE clause using a WorkspaceRunner to the main workspace.

 

 

I hope more effective solutions will be suggested.

 

 

Takashi
Hi,

 

 

Another option can be using the SQLExecutor.

 

 

Itay
Thank you Takashi and Itay for your answers.  

 

 

I just came up with something that works just how I need.  I am using a schema reader to pull the appropriate tables from SDE then I create a query attribute in a python caller assigning a different query to a few of the different tables that I'm pulling.  This gets passed to the feature reader transformer where I set the where clause to the variable I created.  This way each schema that gets passed in gets its own WHERE clause.

 

 

This is exactly what I need.  I just need to alter my python to derive the exact query for each layer since there are hundreds (these are being pulled from MXD definition queries using arcpy library).

 

 

Ultimately this became possible when I found a way to use the schema reader with ArcSDE.  There appears to be no way to pass the SDE connection parameters directly to the schema reader but it turns out that adding an SDE reader as a resource makes the schema reader pick up on the parameters which was the key to getting this thing to work.

 

 

Thank you both for your suggestions.

 

 

Nenad K
I should also mention that the intention is to publish this workspace with FME Server.  Apparently using the workspace runner transformer is not a recommended practice.  With the method that I described below I should be able to publish this workspace on FME Server.
That's a great solution. Thank you for the sharing!
can you share your fmw file

Reply