dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #02862
Re: Where are custom dataelement/indicator attributes stored
Good, let us know how it goes.
Lars
On Tue, Aug 27, 2013 at 10:02 AM, Wilson,Randy <rwilson@xxxxxxx> wrote:
> Thanks Lars.****
>
> ** **
>
> This is very helpful. I have done something similar to add French
> translations for many data elements, so we should be able to figure it out
> with this guidance.****
>
> ** **
>
> Randy****
>
> ** **
>
> *From:* Lars Helge Øverland [mailto:larshelge@xxxxxxxxx]
> *Sent:* Monday, August 26, 2013 9:42 PM
> *To:* Morten Olav Hansen
> *Cc:* Wilson,Randy; dhis2-users@xxxxxxxxxxxxxxxxxxx
> *Subject:* Re: [Dhis2-users] Where are custom dataelement/indicator
> attributes stored****
>
> ** **
>
> Hi Randy, its interesting to hear that you are using DHIS 2 for data
> dictionary purposes.****
>
> ** **
>
> The tables related to data element attributes are:****
>
> ** **
>
> attribute (you have already created those attributes so no need to insert
> anything)****
>
> attributevalue (contains reference to the attribute and holds the actual
> attribute value)****
>
> dataelementattributevalues (contains references to attributevalues and
> dataelements - links these two together)****
>
> ** **
>
> So you must first insert the attributevalue records - should be easy to
> generate that sql from the spreadsheet:****
>
> ** **
>
> insert into attributevalue values (nextval('hibernate_sequence'),
> '<Attribute value>', <attributeid>);****
>
> ** **
>
> Then comes one challenge - you must know the identifier of the
> attributevalue in order to link it to the right data element:****
>
> ** **
>
> insert into dataelementattributevalues values
> (<dataelementid>,<attributevalueid>);****
>
> ** **
>
> ** **
>
> ** **
>
> Not sure how to best fix this but one way could be to create a script
> where you use the currval function and have these two sql commands
> alternating like this:****
>
> ** **
>
>
> insert into attributevalue values (nextval('hibernate_sequence'),
> '<Attribute value>', <attributeid>);****
>
> insert into dataelementattributevalues values
> (<dataelementid>,currval('hibernate_sequence'));****
>
>
> insert into attributevalue values (nextval('hibernate_sequence'),
> '<Attribute value>', <attributeid>);****
>
> insert into dataelementattributevalues values
> (<dataelementid>,currval('hibernate_sequence'));****
>
> ** **
>
> ** **
>
> regards,****
>
> ** **
>
> Lars****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
References