CSV import Program indicators

Is there any possibility to import CSV file of Program indicators on DHIS2 Tracker, Which contains the list of program indicators created, i can clone the program indicators using DHIS2 Application, since i have to clone 541 program indicators which seems to be time consuming.

So i have created the list of indicators with code, lastUpdated, id, created, Name, shortName, aggregationType, displayInForm, aggregateExport,CategoryOptionCombo header but export/import apps using metadata import option doesn’t import,shows no response and no error, :frowning: can any one support in this case?

Hi Roshan, you can try the BIF app (available via the App Management app in DHIS2, or here: https://apps.dhis2.org/) which allows importing of metadata in a .csv file.
It has some helpful information as well to get you started e.g. the way to format the file to allow a proper import.

Edit: actually it doesn’t currently have the option for Program Indicators yet, is sort-of planned to come sometime according to the User Guide… sorry about that.

using the csv side of import/export has always been problematic for me. I’ve consistently resorted to having the details you are describing and subbing them in JSON snippets in Excel, and then copying/pasting into a text editor, and saving as a json file and importing. I know that sounds tedious…and it is…but once you do it a few times it feels like it opens a lot of doors. You can get the structure of the code by grabbing a sample ProgramIndicator in your server by /api/programIndicators and then if you take the first id that comes in and put /api/programIndicators/“id here”.json then you can copy this into excel, and remove all the pieces specific to the PI you have just taken.

What I’ll generally do is get my list of values, and then replace the value of the PI in the “Code” section with “BBB”. value of “LastUpdated” can be “CCC”, “id” “DDD”, “created” “EEE”, so on and so forth. Then i can do a nested substitute in excel, with =substitute(substitute(A2,“BBB”,b2),“CCC”,c2), where A2 is the original PI json snippet.

Anyway, if this feels like something you’d like to go down more, happy to talk more about it.

@Matthew_Boddie Actually if we could know that what is the query to insert programindicators in database, for PI, then we can create the sql query using some tool and generate the query finally firing sql on database…this sort of resolution, i am looking for…if any body can sort it out.

You could export the program indicators via the api using the query below, you can filter it by the program id if you are only want specific indicators:

https://yoursitedomain.org/api/programIndicators.json?includeDescendants=true&paging=false&fields=:all,children[:all,children[:all]]

Save the json output and using the Export/Import module, Import them to intended instance.

Thank you everyone for support, the concept is we need fire sql insert query in 2 relation namely programindicator and periodboundary for creating program indicator with boundary, programindicator relation having one to many relationship with periodboundary relation.

Thank you

I am also facing a similar problem and have resorted to directly firing an sql insert query as suggested by @Roshan.Konda. Got some error about not supplying a value for the column ‘programindicatorid’ and not sure how best I can resolve this.
For the programindicator relation/table, it has these columns programindicatorid (primary key) (required) and uid(required), which I thought would be automatically populated. Since programindicatorid is the primarykey field, am I not right if I expect it to be auto populated when I run the insert query? but it doesn’t. Also tried supplying the programindicatorid (primary key) but it still returns a ‘null value’ error. Not really sure where I’m getting it wrong. Looks more like an sql struggle now :sweat_smile:

Hi Damien, I have tried to install the BIF application and follow the sample files in the application’s instructions. But when I import it gives an error that there is no column ‘Name’. While my csv file is still there. I am using version 2.38. Help me please.

G’ay @thieuhv, can you please attach some logs/screenshots of the error?

1 Like

Sincerely thank you. I’ve done it.