Skip to main content
Question

TestFilter - can you use the output port as table name in PostGIS / FILEGDB writer


I have setup a test filter that separates out a number of shapefiles based on part of the filename. I now want to use the output port that these features will run through as the new table name. Is there an easy way to do this, or do I need to create a writer for each port so that this has the correct table name.

9 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • May 2, 2017

You can use attribute values as the name of the output file.

Instead of using the TestFilter I would have used an AttributeCreator (use the conditional values option) to create different values for the new attribute (e.g. FileName).

Then use that attribute to define the Shape file name in the Writer feature type.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • May 2, 2017

Do you actually need to use a test filter? You could conditionally assign an attribute using the same statements and then fanout on this attribute to create separate shape files


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • May 2, 2017
erik_jan wrote:

You can use attribute values as the name of the output file.

Instead of using the TestFilter I would have used an AttributeCreator (use the conditional values option) to create different values for the new attribute (e.g. FileName).

Then use that attribute to define the Shape file name in the Writer feature type.

Snap!

 

 


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • May 2, 2017
erik_jan wrote:

You can use attribute values as the name of the output file.

Instead of using the TestFilter I would have used an AttributeCreator (use the conditional values option) to create different values for the new attribute (e.g. FileName).

Then use that attribute to define the Shape file name in the Writer feature type.

And an image to explain:

 

 


  • Author
  • May 2, 2017
Thanks for the prompt replies. I have shapefiles that are named like this:

 

SU_AdministrativeBoundary

 

ST_AdministrativeBoundary

 

etc etc. then there are also other types that are defined this way such as Buildings, Roads etc.

 

I was hoping to consolidate these so that all AdministrativeBoundary files could go into a new table or featureclass (file geodatabase) using this generic name, rather then new tables for each different name.

 

 

 

 


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • May 2, 2017
jvanetten wrote:
Thanks for the prompt replies. I have shapefiles that are named like this:

 

SU_AdministrativeBoundary

 

ST_AdministrativeBoundary

 

etc etc. then there are also other types that are defined this way such as Buildings, Roads etc.

 

I was hoping to consolidate these so that all AdministrativeBoundary files could go into a new table or featureclass (file geodatabase) using this generic name, rather then new tables for each different name.

 

 

 

 

So the AttributeCreator would be like this:

 

Attribute Name: TableName

 

Attribute Value: If fme_basename contains "AdministrativeBoundary" Then "AdministrativeBoundary", Else If fme_basename contains "Building" Then "Building" and so on.

 

That would create one attribute containing "AdministrativeBoundary" in both examples.

 

 


  • Author
  • May 2, 2017
erik_jan wrote:
So the AttributeCreator would be like this:

 

Attribute Name: TableName

 

Attribute Value: If fme_basename contains "AdministrativeBoundary" Then "AdministrativeBoundary", Else If fme_basename contains "Building" Then "Building" and so on.

 

That would create one attribute containing "AdministrativeBoundary" in both examples.

 

 

Sorry, I think I am missing something. I cannot do this with my AttributeCreator. I only have two options New Attribute and Attribute Value. How do I enable the conditional values option?

 

 


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • May 2, 2017
jvanetten wrote:
Sorry, I think I am missing something. I cannot do this with my AttributeCreator. I only have two options New Attribute and Attribute Value. How do I enable the conditional values option?

 

 

Click the Value and use the down arrow:

 

 


  • Author
  • May 2, 2017
jvanetten wrote:
Sorry, I think I am missing something. I cannot do this with my AttributeCreator. I only have two options New Attribute and Attribute Value. How do I enable the conditional values option?

 

 

Oh nice one! That does the trick!

 

 


Reply


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