I have a tracked entity called “mother” with an attribute called “identifier.” The values for this identifier are automatically generated using the following text pattern: ORG_UNIT_CODE() + “-” + CURRENT_DATE(yyyyMMdd) + “-” + SEQUENTIAL(#####).
This all works fine when using the Capture app from a web browser. Where I’m running into difficulty is when I want to enrol a new mother on a MEWR program, using the Android app. As this is done offline until sync is done, an identifier cannot be automatically generated. But I cannot save the new record until an identifier is provided! Also, how do I make sure the user is notified of the new identifier?
I suspect there is a combination of settings to get me out of this chicken and egg situation but am not exactly sure what it is!
I think you might find this use case described by @vincentminde helpful (since you need this to be generated offline, it has to be linked to the client-side, not server):
Hi @swoodworth . I don’t see why you couldn´t use that string strictly speaking but, and this is a big but, using CURRENT_DATE(yyyyMMdd) is very likely a bad choice. You can read why in the official doc: Android implementation - DHIS2 Documentation
With your current configuration you will need every user to synchronize every day before they work otherwise all their generated ids will be expired because of using the “day” part.