Solved

Adding date onto feature class name

  • 15 April 2019
  • 4 replies
  • 23 views

Badge

Hello,

I'm looking to read a feature class from a GDB (for testing purposes, but eventually this will be many feature classes so this process requires minimal manual handling) and add the date on the end YYMMDD and write back into the same GDB.

E.G

READ - "TEST"

WRITE - "TEST190415"

I've look at ways of doing this and not many seem to work. The closest I've got is to set the reader to expose the 'fme_basename' -> Date/Time Stamper -> Date/TimeConverter (adding _date column to attributes) -> Attribute Manager where I add a new attribute called "New_name", the value is @Value(fme_basename)@Value(_date)

The write is set to Dynamic Schema Definition with the source as the GDB used and the Schema Definition Name set to "New_name".

The output is the GDB name.

When I edited this to just the _date, the output was the date.

So the basename is being read as the gdb, and the date is being picked up in the new attribute.

Can someone please help? I imagine there must be a simpler way to simply add a date onto a feature class name.

Workbench below:

icon

Best answer by nielsgerrits 16 April 2019, 08:36

View original

4 replies

Userlevel 6
Badge +32

The way I get this to work is to read both data and schema features, rename fme_feature_type / fme_feature_type_name and write dynamic. I remember seeing somewhere @takashi managed this in a different way but can't recall how exactly and this works for me.

Not sure what causes the new featureclass name to start with an underscore.

I'm used to work with FeatureReaders / FeatureWriters, but this can be done with classic Readers / Writers as well.

2019.0 template workspace added for testing / reproducing.

gdbreadwrite.fmwt

Userlevel 2
Badge +17

The way I get this to work is to read both data and schema features, rename fme_feature_type / fme_feature_type_name and write dynamic. I remember seeing somewhere @takashi managed this in a different way but can't recall how exactly and this works for me.

Not sure what causes the new featureclass name to start with an underscore.

I'm used to work with FeatureReaders / FeatureWriters, but this can be done with classic Readers / Writers as well.

2019.0 template workspace added for testing / reproducing.

gdbreadwrite.fmwt

If you set Schema Definition Name explicitly, you don't need to modify the values of "fme_feature_type_name" in the schema feature and "fme_feature_type" in the data features.

Userlevel 6
Badge +32

If you set Schema Definition Name explicitly, you don't need to modify the values of "fme_feature_type_name" in the schema feature and "fme_feature_type" in the data features.

Thanks, this is really easier.

Badge

The way I get this to work is to read both data and schema features, rename fme_feature_type / fme_feature_type_name and write dynamic. I remember seeing somewhere @takashi managed this in a different way but can't recall how exactly and this works for me.

Not sure what causes the new featureclass name to start with an underscore.

I'm used to work with FeatureReaders / FeatureWriters, but this can be done with classic Readers / Writers as well.

2019.0 template workspace added for testing / reproducing.

gdbreadwrite.fmwt

This works perfectly. Thank you so much! (I just tweaked it to add the date on the end and not before the feature name.

Reply