Question

Rename file after translation

  • 14 December 2016
  • 5 replies
  • 11 views

Badge

I'm currently reading from and writing to the same GDB. What I would like to do is rename the filename after the workspace is complete with certain attribute values that I had set from within the workspace. The only way I came across was using a Python shutdown script and I'm still very new to Python and I'm having some trouble in getting started.

I have 5 attribute values all set within the workspace which I would need to use for the final file naming convention.

SR, AFE, PNUM, DATE

 

The final naming convention would be: DB_TGS_SR_AFE_AP_PNUM_00_DATE.gdb

Any help with this would be greatly appreciated. Thanks!

 


5 replies

Userlevel 2
Badge +17

Hi @madwarren, if you use the Fanout Dataset functionality of the writer, you can write the features into your desired destination dataset directly and don't need to rename afterword.

Alternatively, the FeatureWriter transformer can also be used in FME 2016+.

Badge

Thanks @takashi for your reply. I tried using the Dataset Fanout option in the writer as you suggested and it just created multiple gdb's on a feature basis fanout. Do you think the problem is that my writer is a Dynamic GDB?

Also, I'm actually using the FeatureWriter in my workspace for an Excel output. Using that will still create the correct output file, but not rename the original file which is what I'm trying to do.

Any other suggestions? Thanks for the help.

 

Badge

Thanks @takashi for your reply. I tried using the Dataset Fanout option in the writer as you suggested and it just created multiple gdb's on a feature basis fanout. Do you think the problem is that my writer is a Dynamic GDB?

Also, I'm actually using the FeatureWriter in my workspace for an Excel output. Using that will still create the correct output file, but not rename the original file which is what I'm trying to do.

Any other suggestions? Thanks for the help.

 

I'm writing from and to the same GDB file. I was thinking I could rename it in the outcome without having to have an additional file created, or having to delete the original.

 

 

Userlevel 2
Badge +17

Thanks @takashi for your reply. I tried using the Dataset Fanout option in the writer as you suggested and it just created multiple gdb's on a feature basis fanout. Do you think the problem is that my writer is a Dynamic GDB?

Also, I'm actually using the FeatureWriter in my workspace for an Excel output. Using that will still create the correct output file, but not rename the original file which is what I'm trying to do.

Any other suggestions? Thanks for the help.

 

If the Dataset Fanout generated multiple datasets (i.e. multiple *.gdb folders), the attribute values (SR, AFE, PNUM, DATE) could be different among output features.

 

I didn't assume that you need to update the source gdb and then rename that. In such a case, the Dataset Fanout may not be suitable. As you mentioned, the shutdown script could be used to rename a destination dataset, but in FME 2016+, the File Copy writer might also be useful to rename (move) the gdb folder after updating the gdb with the FeatureWriter.

 

Badge +16

Hi @madwarren, After writing the file with the FeatureWriter, you can use a SysteemCaller transformer to rename the output with a DOS command, old fashioned but it works.

Reply