Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Blog
  • Questions
  • Learning
    • E-learning Courses
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Tutorials
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Using AutoIncrementFieldDescriptor in a CRUD script

Solved347 views13th March 2025DOM CRUD
1
Felix Wesemeier [DevOps Catalyst]1.81K 26th February 2025 0 Comments

Hi community,

does someone has an example how to create a AutoIncrementFieldDescriptor value  withinin a CRUD script when creating an instance?

My resulting ID has an incrementing part but there is another variable part for the year within the same field: YY/{0:000000000}, e.g. 25/000000123

And I don't want to hardcode the year.

Felix Wesemeier [DevOps Catalyst] Selected answer as best 13th March 2025

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
1
Thomas Ghysbrecht [SLC] [DevOps Enabler]4.79K Posted 6th March 2025 5 Comments

Hi Felix,

You can indeed use the IncrementHelper to get the next value for a given incrementer by ID. When you use the AutoIncrementFieldDescriptor, the same underlying API is used by the DOM manager to get the next value. With this helper, you could build your own incrementing ID by hooking into the 'create' actions with a CRUD script and update the DOM instance with your custom ID. Keep in mind though that this does mean every create will result in another update, increasing the load on the system for every create action. As the script is executed asynchronously, you may also have a situation where the ID field would not be populated yet if you for example would create the DOM instance in a form and then have a table refreshed right after the save.

I see in your post that you would prefer to avoid hard-coding the year, but in a way, this does provide a more performant solution in general. A simple script could be made which is run around the new year period with a scheduled task that would update the AutoIncrementFieldDescriptor with the new year every time.

Note that with the CRUD script approach, the same limitation applies here as mentioned in the 'Important' section on the docs page for that FieldDescriptor. In some very rare cases where there would be database issues, you may run into having the same ID being returned by that incremementer. We have only seen this issue once in the past, but keep in mind that it would be safer to not have your solution/code rely on these IDs being 100% unique. Ideally, these IDs are used as a visual indication to easily find the DOM instances back, where it would not be a system-breaking issue if two instance would be found in very rare cases.

There are plans to make the AutoIncrementFieldDescriptor obsolete for that exact reason. A new field descriptor may be added in the future instead which also makes it possible to generate a unique human-readable string. (But it won't be a number incremented by one each time)

Felix Wesemeier [DevOps Catalyst] Posted new comment 14th March 2025
Felix Wesemeier [DevOps Catalyst] commented 12th March 2025

Hi Thomas,

thanks for the idea with the scheduled script to update the field itself.
This works fine.
But I noticed after updating this field, it is the last one in the section (was the first before).
Any way to avoid this?
I used GetAllFieldDescriptors, then AddOrReplaceFieldDescriptor and then Update to write the Field Decriptors to the CustomSectionDefinition

Thomas Ghysbrecht [SLC] [DevOps Enabler] commented 12th March 2025

The 'AddOrReplaceFieldDescriptor' method will indeed remove the existing descriptor (if it exists) first and add it to the list again, resulting in it being the last one.

In theory, if you have retrieved the AutoIncrementFieldDescriptor from the SectionDefinition without cloning the object via LINQ for example (FirstOrDefault), you can just change the 'IDFormat' property of the AutoIncrementFieldDescriptor. The descriptor that you retrieved via 'GetAllFieldDescriptors' is still part of the collection on the SectionDefinition, so after changing the 'IDFormat', you should be able to just pass it to the update method as you already did. The difference thus is not calling the 'AddOrReplaceFieldDescriptor'.

Felix Wesemeier [DevOps Catalyst] commented 12th March 2025

Do you have an example how to get the section without cloning the object?

Thomas Ghysbrecht [SLC] [DevOps Enabler] commented 12th March 2025

It's the FieldDescriptor actually that should not be cloned. If you just use LINQ, they won't be cloned, so it's just a matter of not calling 'Clone' yourself. I have made an example that hopefully clarifies how this update can be done: https://github.com/Skyline-ThomasGH/DataMiner_ScriptExamples/blob/main/DOM_UpdateFieldDescriptorProperty.xml

Felix Wesemeier [DevOps Catalyst] commented 14th March 2025

Thanks for providing this example!
It works fine.

You are viewing 1 out of 2 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas

Recent questions

Alarm Dashboard PDF/CSV Export 0 Answers | 0 Votes
Is the Microsoft SharePoint Connector Still Usable 0 Answers | 0 Votes
Is the Microsoft SharePoint Connector Still Usable 0 Answers | 0 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (108) Correlation (68) Cube (150) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (139) driver (65) DVE (55) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (151) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) services (51) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin