Organizational structure only returning 1 value for every level?

I am having an issue with my organizational structure where province district and site location data is returning only 1 result in the app even though i have multiple locations for each level!

I followed the instructions from this link which helped alot, but as I said above its still not right.
https://help.commcarehq.org/display/commcarepublic/Assigning+Cases+to+One+of+Multiple+Locations

These are my organizational levels

This is my structure which shows all the levels and data clearly, province, district, site.

This is my lookup table data question for province which should return South Africa and North Africa


I am not sure why when I type in locations in Instance ID it adds the -1 so it reads locations-1 instead of just locations. I cant seem to change it though, adds it automatically.

Then in the app itself this is the only option I get in the list. North Africa is missing?!

It is the same story for the other levels district and site.
Would really appreciate any help, not sure if I am blind and just missing something here, just doesnt make sense to me, in my mind it should work.

Hi Calvin,

I think I can clarify what you’re seeing.

The organization hierarchy is designed to be able to keep track of huge trees with thousands of leaves, so by default, when a user syncs, they are only sent down the locations in the line between the root of the tree and their assigned location.

You can tune this behavior to your use case, though, using the advanced organization options you listed above.

Specifically, I think you want to look at the “Level to Expand From,” column, which dictates that for users assigned to a location in that level, that they should get a fully expanded tree below the “Expand From” Level specified.

In your case I think you want to set that level to expand from to be “root” for the “Site” row, which means that anyone assigned to a Site location will see the tree fully expanded from the root down.

-Clayton

Thank you so much for the explanation Clayton that makes sense.
Its working now as I was hoping it would.

@Clayton_Sims Im hoping you can further assist me here. I am now able to select the exact location using the fields described above for a province, district and site. I have these fields setup on both a case and a survey form and it works to select a province district and site. Filtering downwards as you select.

I am probably missing something again. My hope was that now after capturing some test forms, cases and surveys, that when using the reporting section “Inspect Data” I would be able to filter those forms captured by location. I am pretty sure I have missed something here again or am not understanding this correctly as it isnt filtering it by location for either cases or surveys.

This is case filter returning 4 records when i am expecting 2 records for East London Hospice. (Captured 2 for east london hospice and 2 for cape town hospice)

This is the survey filtering showing the 2 test surveys i submitted, one for East London Hospice and one for Cape Town Hospice. I am however only wanting the survey that was done for the East London Hospice so only expecting back 1 record.

My end goal which I am hoping is achievable is to be able to have a survey or case be captured with its location values province district and site selected from within the survey or case. Then when reporting is needed to be done one could type in the location at different levels say for instance if the user wanted all the cases that were for a paticular site or for a particular district.

I would so super appreciate if you could give me some insight here again.

Kind Regards,

Hi Calvin,

I think the “Case Owner’s” box is an AND filter for the data, so the “Project Data” item that’s in the search along with the hospice location will result in ~all records being returned. Do you get the expected result if you remove it?

-Clayton

Hi @Clayton_Sims,

Thank you so much for the response. I really appreciate your feedback and assistance. Yes are correct, it does look like its using an AND filter. I removed project data and got back the only the 2 records I expected to get back. However there is something else I noticed from following this link.
https://help.commcarehq.org/display/commcarepublic/Assigning+Cases+to+One+of+Multiple+Locations
Right at the end of that page and we are specifically working with a case now. It tells you to set a case property called “owner_id” = [sitelocation].

[sitelocation] being the location that the user selected.
It worked correctly for all the records where I had owner_id set as a property. The other records I captured prior to setting that case property owner_id dont display when using the location filter.
Which I am fine with, my understanding then is the site location is then the owner of that case and thats how it filters cases per location.

However, how do I set the owner_id on survey so that the same filtering will work on the submit history page for surveys?

This is using the standard filters, you can see below that there are 2 records, one captured Under East London and the other under Cape Town.

Now in this image only expect to see one record for East london, but nothing displays.

Am I missing something again here?

Interesting.

Form submissions don’t have “owners,” exactly, they only have the identify of the user who submitted the data in question. Is the user you mentioned currently assigned to the East London Hospice? I’m honestly not 100% sure how locations interact with the form submit history data filter, although the confluence wiki might have more details.

-Clayton

If you select a location as the filter in the submit history report, it should show forms submitted by users at that location or its children. That is, if the user who submitted a form is currently assigned to “East London Hospice”, I’d expect that to show up in the second screenshot above.

@Calvin, you wrote

This is using the standard filters, you can see below that there are 2 records, one captured Under East London and the other under Cape Town.

However in the screenshot, I see both forms were submitted by the same user. Even if the form opened a case at a particular location, the form itself is still associated with the location of the user who submitted it.