List active Health facility based one dataset

Hi All,

Could you help me how to list active health facility using specific dataset please
I have all facility from sql view but I don’t know how to show only health facilities using specific dataset.

Thank you for your help.

Joelson

2 Likes

Hi @mangamanga,

I guess you are trying to see which organization units are linked to the dataset?

  • Go to the Dataset then click on " 11 " then select Show Details. you will see a link on your right-hand side to an API.
    tempsnip
    when you click on it, scroll down and see the Org Unit ID’s for the facilities that are linked to the dataset. Annotation%202019-04-15%20131011
    I hope you are able to use the API? - if not, let me know.

Best,
James.

1 Like

I can see API but I don’t know yet how to use it.
I would like to show these facilities on sql view if possible.

Thank you

2 Likes

I see UID code but how to list them in one table please.
Thanks

1 Like

Hi @mangamanga,

Kindly allow me to link you up with @Emma_Kassy to have a look at this as we see what other members think about this.

Best,
James

It’s ok thank you in advance.

1 Like

@mangamanga
Fill the dataset uid accordingly
Try using this sql below:

SELECT
ou.uid as orgunituid,
ou.name as orgunitname,
ds.name as datasetname
FROM
dataset ds,
datasetsource dss,
organisationunit ou
WHERE
ds.datasetid = dss.datasetid AND
dss.sourceid = ou.organisationunitid
AND ds.uid = ‘xxxxxxxx’;

Let us know if this helps!
Cheers,
Emma.

1 Like

Thanks for this @Emma_Kassy.

Thank you.
I tryed to use this code but I have this message :
“ERROR: column “‘XXXXXXXX’” does not exist Position : 256”
But API went on.

1 Like

@mangamanga
The idea is to fill in the dataset uid where “xxxxxxx” exists.

Cheers,
Emma

1 Like

I changed the code into UID of dataset but still the same message.
What I do to fix it please.
Thx

1 Like

Hi @mangamanga use single quotes for ds.uid as ‘XXXXXXX’

1 Like

@mangamanga
Can you test if this query works on play demo too, just to make sure it works in another environment.

Also, what version of dhis2 are you running?
I tested query on 2.30

Cheers,
Emma

1 Like

Hi all,
It works fine. Thank you all.
Could you help me again hot to show parent level please. Health facility is level 5 and I want to show level 4, 3, and 2.

Thanks again

1 Like