Auto generate ID generate even numbers

Dear community greetings,

Please help me to solve the problem of auto generate ID number, It generates even numbers except odd.

Formula i used: “VTS-”+SEQUENTIAL(####)
This formula should generate even and odd numbers in a sequence like:

VTS-0001
VTS-0002
VTS-0003

But it dose not, it generates only even numbers like:

VTS-0002
VTS-0004
VTS-0006

I used this formula in DHIS2 demo database it was generating even odd numbers but in my DHIS2 database it generates even number not odd, Please comment what’s wrong with this formula or any suggestion?

My DHIS2 database version: 2.32.8

Regards
Jan Agha Stanikzai

Hi @janagha,

I see in the docs:

SEQUENTIAL segments are in the implementation numbers starting from 1, increasing by 1 for each value, sequentially until no more values are available. However, in reality you will most likely end up with gaps when users generate and reserve values that is never used, or if a user sends in a value where the SEQUENTIAL segment has a higher value than recorded on the server.

Could it be this situation? That this sequence has been used in some way in your database but not in the demo database?

Thanks!

Dear @Gassim
Thank you so much for response but it is possible to generate sequential number in DEMO DHIS2, not in my instance.
Please see the picture of both instances and their versions:

DEMO DHIS2
Version: 2.34.9

HNI DHIS2 instance
Version: 2.32.8

Do not you think versions affect the instances?

Regards
Jan Agha Stanikzai

Dear Community of Experts,

Please comment on above post

difference between DHIS2 DEMO and Self owned DHIS2 instance auto generated ID number.

Regards
Jan Agha Stanikzai

It might be because some of these gaps in your instance are due to reserved values. Would you please try the same formula but changing VTS into something else. For example, ABC (if this has not been used before) to see if you will get gaps or not.

Thanks! (:

Thank you @Gassim
But it does not work still it generates even numbers the way you suggested.

I would like to ask one another question, Why the image does not show in event report (Pivot)?

Regards
Jan Agha Stanikzai

Hi @janagha

There’s no problem with your pattern. What version of DHIS2 are you using?

What this usually is, is the app reserving extra values. When you open a form that uses the attribute that is automatically generated, the app will reserve a new value. If you open a form, dont save it, then open it again, it will be a new value.

Most likely one of the steps you take when checking this, is generating a value without you seeing it, so you always end up at the even numbers. Since it’s just even, I would assume it happens before you see the value (Ie. if you open up a tracked entity profile, it might generate there)

1 Like

@janagha I sent @Stian your DHIS2 instance version number, and it seems that this as he mentioned above, an issue when the app is reserving values in a different way than they are supposed to, but there’s no workaround for this now and it won’t be fixed in that version.

Your pattern is 100% correct so I’d suggest testing it in any of the other instances on the play.dhis2.org site and see which one works for you, if you decide to upgrade!

Dear @Gassim and @Stian

Thank you so much for your efforts and assistance.

Regards
Jan Agha Stanikzai

1 Like

You’re welcome! Would love to hear back which approach you decided to take? Thank you! (: