I have an organisation with the following levels: Country / Zone / Province
/ District / Health Facility. I have also assigned mobile workers to these
locations.
I am now trying to retrieve the mobile worker's country and assign it to a
form variable. What would be the syntax to do so please?
The syntax is quite ugly, unfortunately. Additionally, it requires that you
assign all users to the same level of the hierarchy (and depends on that
hierarchy). We are hoping to extend formbuilder to do this more seamlessly
in the future, but for the time being, the following page might help.
···
On Sat, Oct 31, 2015 at 9:30 AM, Alexandre Vanobberghen < alexandre.vanobberghen@gmail.com> wrote:
Hello,
I have an organisation with the following levels: Country / Zone /
Province / District / Health Facility. I have also assigned mobile workers
to these locations.
I am now trying to retrieve the mobile worker's country and assign it to a
form variable. What would be the syntax to do so please?
Thanks for your response.
All my users are assigned to health facilities i.e. the lowest level of the
hierarchy.
I tried to use the link you sent to formulate the following syntax:
···
Le dimanche 1 novembre 2015 11:59:54 UTC+1, Cory Zue a écrit :
>
> Hello,
>
> The syntax is quite ugly, unfortunately. Additionally, it requires that
> you assign all users to the same level of the hierarchy (and depends on
> that hierarchy). We are hoping to extend formbuilder to do this more
> seamlessly in the future, but for the time being, the following page might
> help.
>
>
> https://confluence.dimagi.com/display/commcarepublic/Referencing+the+Location+Hierarchy+in+Applications
>
> cheers,
> Cory
>
> On Sat, Oct 31, 2015 at 9:30 AM, Alexandre Vanobberghen < alexandre.v...@gmail.com > wrote:
>
>> Hello,
>>
>> I have an organisation with the following levels: Country / Zone /
>> Province / District / Health Facility. I have also assigned mobile workers
>> to these locations.
>> I am now trying to retrieve the mobile worker's country and assign it to
>> a form variable. What would be the syntax to do so please?
>>
>> Thank you,
>>
>> Alex
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "commcare-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to commcare-user...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
This looks like it could be a bug on our side. I'm going to make a ticket
for the issue and someone on our team will follow up soon.
thanks,
Cory
···
On Mon, Nov 2, 2015 at 9:41 AM, Alexandre Vanobberghen < alexandre.vanobberghen@gmail.com> wrote:
Hello Cory,
Thanks for your response.
All my users are assigned to health facilities i.e. the lowest level of
the hierarchy.
I tried to use the link you sent to formulate the following syntax:
Le dimanche 1 novembre 2015 11:59:54 UTC+1, Cory Zue a écrit :
Hello,
The syntax is quite ugly, unfortunately. Additionally, it requires that
you assign all users to the same level of the hierarchy (and depends on
that hierarchy). We are hoping to extend formbuilder to do this more
seamlessly in the future, but for the time being, the following page might
help.
I have an organisation with the following levels: Country / Zone /
Province / District / Health Facility. I have also assigned mobile workers
to these locations.
I am now trying to retrieve the mobile worker's country and assign it to
a form variable. What would be the syntax to do so please?
Thank you,
Alex
--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Having the hierarchy Country / Zone / Province / District / Health
Facility, I assigned my "test" mobile worker to a health facility.
I can get the location ID using:
instance('commcaresession')/session/user/data/commcare_location_id.
However, the following command fails:
instance('locations')/countrys/country/zones/zone/provinces/province/districts/district/health_facilitys/health_facility[@id
= instance('commcaresession')/session/user/data/commcare_location_id]/name
I get the following error when opening the form:
"Error occured - The problem was located in calculate expression for
/data/variables/userLocationName
XPath evaluation: type mismatch
instance('locations')/countrys/country/zones/zone/provinces/province/districts/district/health_facilitys/health_facility[@id
= instance('commcaresession')/session/user/data/commcare_location_id]/name
was not found"
Not sure what the issue is. Is the issur the command's syntax? Or the
actual location ID?
Any idea?
On your Organization levels page, can you click on the Advanced checkbox
and review the organization level codes you have. These should match what
you're using in your syntax above.
Does the actual location ID calculate correctly?
Thanks,
Sheel
···
On Tue, Nov 24, 2015 at 9:39 AM, Alexandre Vanobberghen < alexandre.vanobberghen@gmail.com> wrote:
Hi Cory,
The above issue was fixed by Sheel, thanks for this!
Having the hierarchy Country / Zone / Province / District / Health
Facility, I assigned my "test" mobile worker to a health facility.
I can get the location ID using:
instance('commcaresession')/session/user/data/commcare_location_id.
However, the following command fails:
instance('locations')/countrys/country/zones/zone/provinces/province/districts/district/health_facilitys/health_facility[@id
= instance('commcaresession')/session/user/data/commcare_location_id]/name
I get the following error when opening the form:
"Error occured - The problem was located in calculate expression for
/data/variables/userLocationName
XPath evaluation: type mismatch
instance('locations')/countrys/country/zones/zone/provinces/province/districts/district/health_facilitys/health_facility[@id
= instance('commcaresession')/session/user/data/commcare_location_id]/name
was not found"
Not sure what the issue is. Is the issur the command's syntax? Or the
actual location ID?
Any idea?
Thanks,
Alex
On Monday, November 2, 2015 at 8:58:40 AM UTC+1, Cory Zue wrote:
Hey Alex,
This looks like it could be a bug on our side. I'm going to make a ticket
for the issue and someone on our team will follow up soon.
Thanks for your response.
All my users are assigned to health facilities i.e. the lowest level of
the hierarchy.
I tried to use the link you sent to formulate the following syntax:
Le dimanche 1 novembre 2015 11:59:54 UTC+1, Cory Zue a écrit :
Hello,
The syntax is quite ugly, unfortunately. Additionally, it requires that
you assign all users to the same level of the hierarchy (and depends on
that hierarchy). We are hoping to extend formbuilder to do this more
seamlessly in the future, but for the time being, the following page might
help.
I have an organisation with the following levels: Country / Zone /
Province / District / Health Facility. I have also assigned mobile workers
to these locations.
I am now trying to retrieve the mobile worker's country and assign it
to a form variable. What would be the syntax to do so please?
Thank you,
Alex
--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks, this solved it.
I was in fact referring to the organisation level rather than the type
code. So I replaced "health_facility" by "health-facility" and it did the
trick.
···
On Tue, Nov 24, 2015 at 11:23 AM, Alexandre Vanobberghen < alexandre.vanobberghen@gmail.com> wrote:
Hi Sheel,
Thanks, this solved it.
I was in fact referring to the organisation level rather than the type
code. So I replaced "health_facility" by "health-facility" and it did the
trick.