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?
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?
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:
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.
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)
@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!