← Back to team overview

dhis2-users team mailing list archive

Re: How to create entity attribute with generated value based on others elements

 

HI Gerard

Yes, this is possible with Text Pattern as mentioned previously.

One thing I would like to point out is that you create this all in the TE
attribute. Therefore, create an attribute (e.g. Unique ID) and then select
"Automatically generate".

In the pattern, you can then enter the TextPattern that you require. Please
note that to create a string, you separate with - and not with +. This is
an example I created:
CURRENT_DATE(yyyy-MM-ww)-"-"-ORG_UNIT_CODE(.........)-"-"-"A"-SEQUENTIAL(###)

The "-" creates the dashes between the various variables, while the -
separates the variables.

The number of dots and hashes in the OU code and Sequential relate to the
number of items shown.

I hope this helps.

Kind regards,
Terence

Terence Scott

Global Alliance for Rabies Control (GARC)
Pan-African Rabies Control Network (PARACON) Steering Committee
terence.scott@xxxxxxxxxxxxxxxxxx
https://paracon.rabiesalliance.org
Skype: tpscott1987



On Wed, Nov 14, 2018 at 8:32 AM Em Le Hong <em.hispvietnam@xxxxxxxxx> wrote:

> Hi,
>
> You can use Text Pattern
> https://docs.dhis2.org/2.30/en/user/html/working-with-textpattern.html
>
> Good luck!
>
> On Wed, Nov 14, 2018 at 12:51 PM Gérard Bisama <gerbis2000@xxxxxxxxx>
> wrote:
>
>> Hi everyone,
>>
>> I am using tracker and I want to create a entity attribute with generated
>> value that depending on other attributes values like :
>> - code of the orgunit assigned to program
>> - value of the field sex
>> - followed by random number of 4 digit.
>> Each of them separated with "-".
>> Do some one have an idea on how to achieve this?
>>
>> Thanks,
>> --
>> Gérard Bisama
>> Tel:+243810890810
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
> --
> *Em Le Hong*
> DHIS2 Implementation| *HISP Vietnam *
> em.hispvietnam@xxxxxxxxx | *Skype:* em.hispvietnam@xxxxxxxxx
>
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References