Automatic generation of Unique ID using Org_Unit_Code - NOT WORKING

Hello all,

I’m trying to generate a unique ID using the ‘ORG_UNIT_CODE(^…$)+SEQUENTIAL(#####)’ pattern but it isn’t working. Checking the developer tools, I’m getting “ORG_UNIT_CODE not found” error on the console. Any idea what could be wrong?

P.S: I’m using version 2.40.4

I kicked this around in Play, and could get it to accept the format if I removed the ^ and $, i.e. SEQUENTIAL(#####)+ ORG_UNIT_CODE(…)

From Documentation:

Text format allows for marking both the start and end of the input value, but “^…” and “…” will in reality give exactly the same results. The only time you would want to use “^” is when you want to enforce the length of the input value. For example, “^…$” will accept OSLO, since its 4 characters between the start and end, but PARIS will be rejected, since it has 5 characters.

Anyway, seems like it should accept your format, but perhaps you can get around it like this and then set up a ticket to get the format to be included later on.

Thank you for your response.

I tried your suggestion, but it still doesn’t work. I’m using DHIS2 locally, could that be the reason?

that’s odd–I was on play v40. Can you try there quickly?

Hello,

Please try to reduce the number of dots (.) or eliminate the (^) sign because sometimes the number of generated digits could be greater than allowed.

Best regards,
Ayman

Speaking of which, I haven’t been able to log into the DHIS2 play since yesterday through today. I’m using the admin/district details but not working. Could someone else help confirm.

Thank you, yes I did that as well, but no luck.

I couldn’t either, I’ve been using the nightly versions which still have accurate admin/district logins

1 Like

I’ve figured out why it wasn’t working. I didn’t realize the ORG_UNIT_CODE was using the ‘code’ variable not ‘UID’, and my Code variable was blank. Thank you all for the support!

1 Like

Dear @Rae,

Thank you for the update.

I’m glad to hear that you were able to identify the issue with the ORG_UNIT_CODE. It’s great that you found the discrepancy with the ‘code’ variable instead of the ‘UID’ and resolved it.

If you have any further questions or need additional support, please don’t hesitate to reach out.

Best regards,
Ayman

Best regards,

1 Like