Quantcast
Channel: PTC Community : Popular Discussions - Integrity
Viewing all articles
Browse latest Browse all 3432

Sequence number for a field

$
0
0

Hello Community,

 

for a apecial "storage" item, there is the requirement, that a unique sequence number shall be generated. The number shall start on the 1st of January with 1 and then shall be incremented by 1 for every item created during the year.

 

Examples: 16-0246, 17-0001, 17-3564 (formatting is not the problem)

 

What would be the preferred method to implement this sequence number (for native databases there is the feature "autoincrement" but this is not available for Integrity fields).

 

My ideas so far:

  • count over existing items (of the current year, but cannot imagine a query rule other than setting date interval manually every year) by query/aggregation, incement result by 1 and store in global field.
  • Fire a trigger on Jan 1st and reset sequence in  global field

 

Glad to hear about your contributions
Harald


Viewing all articles
Browse latest Browse all 3432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>