Skip to main content

Hi all,

I am using the Overwrite Existing Geodatabase/Template Geodatabase functionality:

This creates a new copy of my gdb with a “_yyyymmdd” suffix. 

However, if my users run this multiple times a day, they have to delete the output of the previous run.

I would prefer there to be a “_yyyymmdd_N” suffix, with N being incremented for every time the workspace has finished running that day.

What is the sleekest way to implement this?

 

I now have built something with a Path FeatureReader and a combination of Testers and StringConcatenators to filter out and manipulate the different filenames with either no suffix, a date suffix or a date+N suffix. Then FeatureJoiners to join the different path features into one:

It works but its bulky and it feels overengineered.

Any inputs?

 

Kind regards,

Joep

Does it really have to be a consecutive number? Would, for example, an addition to hour-minute-second to the filename be sufficient? That’s a lot easier to achieve and unless you have multiple people running it at the same second it should be unique.


Does it really have to be a consecutive number? Would, for example, an addition to hour-minute-second to the filename be sufficient? That’s a lot easier to achieve and unless you have multiple people running it at the same second it should be unique.

This is how I solved it. 


Hi guys, thx for the quick replies, yeah I've considered using _yyyymmddhhmmss or something similar as a suffix, but the (future) users I've talked to so far all said they'd appreciate _N. 


I would just make it a bit more readable. My default datetimestamp scripted parameter looks like this, works like a charm:

import datetime  return datetime.datetime.now().strftime("%Y_%m_%d__%H_%M_%S")


Hi guys, thx for the quick replies, yeah I've considered using _yyyymmddhhmmss or something similar as a suffix, but the (future) users I've talked to so far all said they'd appreciate _N. 

It has to run on Form, right? If it’d be Flow you could use the Job ID. They’re not consecutive per workspace, but they are unique and “simple”


Hi guys, thx for the quick replies, yeah I've considered using _yyyymmddhhmmss or something similar as a suffix, but the (future) users I've talked to so far all said they'd appreciate _N. 

It has to run on Form, right? If it’d be Flow you could use the Job ID. They’re not consecutive per workspace, but they are unique and “simple”

Yes this is running on Form, but there is some debate about moving all of this to Flow. I'll keep this in mind if we ever get there.

In the meanwhile I think I'm opting for ​@nielsgerrits’ approach with a formatted datetime suffix. 

Appreciate the help guys!


Could use

  1. PATH Reader to find all  <FGDB Base Name>*.gdb Folders
  2. Tester to filter any of those Folders with today’s yyymmdd
  3. Add a dummy entry with Creator for FGDB Path = <FGDB Base Name>_yyyymmdd_00.gdb in case the Reader+Tester returns nothing (because the first FGDB hasn’t been generated yet for the day)
  4.  Sorter to takes PATH Reader/Tester Features + Dummy Creator Feature and sort FGDB Path by Path, descending order
  5. Sampler to take Top 1 result (the most “recent” run for the day)
  6. String manipulation (StringReplacer with RegEx, or SubStringExtractor->AttributeCreator to remove last 2 chars and add back two new characters incremented by +1 , whatever works)
  7. Join this incremented path+1 to the Features to be Written and using this as your Path Parameter in the Writer