Sequence Number such as (1,2,3) Program Rule

Dear Experts,

I hope this email finds you well, Please let me know how to allow user to enter sequence number and the system does not accept duplicate numbers. I have a column named Number I want it should start from 1 for each org.

Waiting to receive feedback.

Regards
Mohammad Ayub Yousafzai

Hi,
Thanks!

Would add more details and an example, please? Thank you!

Dear @Gassim ,

Thank you for your reply, I have a (No) Data Element Just I want to start it from 1 and go on for each department as a sequence Number.

Please let me know how to do this in Program Rule.

Thank you in Advance
With Best Regards
Mohammad Ayub Yousafzai

You’re welcome! Thank you! :slight_smile: Would you please describe the use case further because it might help with finding a solution?

There is an option to use autogenerated values based on a TextPattern which has a function called SEQUENTIAL(); however, these autogenerated values are for Tracked Entity Attributes in a Tracker program. You are asking about a program rule so I believe you are using a tracker program so instead of using a data element you could use a tracked entity attribute. (In a TEA select ‘unique’ and an option will appear ‘automatically generated values’)

However, the sequence is not exactly strict about the order of which value was inserted. To understand this better have a look at this explanation: Question regarding Expiry of reserved IDs of an auto-generated unique values configured with a text pattern containing CURRENT_DATE(MM-yyyy):