This question has been flagged
2 Replies
12800 Views

I'm wondering if it's possible to create a sequence that resets at the end of every day (so that it is essentially just a count of the number of records created that day).

Example format: PO-%(y)s%(month)s%(day)s- where n is the number that resets to 1 every day 

The goal is to then generate records such as:

Day 1 (July 10, 2019)

  • PO-190710-1

  • PO-190710-2

  • PO-190710-3

  • ...

Day 2 (July 11, 2019)

  • PO-190711-1

  • PO-190711-2

  • ...

Anyone know if this is possible?

Avatar
Discard
Best Answer

Hi Mike:

You can define date ranges for the sequence number with the ability to reset the number i.e. start with 1, for each date range. If you change the definition of the prefix of the sequence to "PO-%(y)s%(month)s%(day)s-" and define date ranges that span 1 day each, you should get the desired result.

The definition of the sequence can be updated by going into Developer Mode and navigating to Settings > Technical > Sequences (under Sequences and Identifiers). You will need to select the "Use subsequences per date_range" checkbox to add the date ranges to the sequence definition.

Hope that helps.

Avatar
Discard
Author Best Answer

Hello Paresh,

Thank you for your reply, but what you suggest seems impractical when it comes to resetting after every day.  Are you suggesting creating a sub-sequence line for every single day? As far as I can tell, this feature is more practical for larger timeframes (years, quarterly), where the number of necessary line items is manageable.

...or perhaps I'm misunderstanding how subsequences are used?

Avatar
Discard

Hi Mike: If you need to reset the sequence every day, this seems to be the way to do it without making any changes to the core functionality. I agree that it will be cumbersome to have an entry for each date. The other option would be to develop a customization that overrides the core functionality. You could also explore the possibility of using an automated action to generate the document number to override the default functionality.