Error on "Distance from current location" case detail

When using the "Distance from current location" option in a module's Case
Detail, I get the following error when running die form:

The problem was located in if(here() = '' or instance('casedb')/casedb/case[
@case_id=index/parent]/gps_position = '', '', concat(round(distance(instance
('casedb')/casedb/case[@case_id=index/parent]/gps_position, here()) div 100)
div 10, ' km')): cannot handle function 'here'

From the looks of it when there is no data in GPS location it should
default to an empty value otherwise calculate the actual value.
The "here()" I'm guessing is the current location of the device? So if I'm
previewing the form on a PC here() won't have a value, maybe it is NULL,
since the location cannot be retrieved.
I'm guessing this is what is causing the error, since I'm am able to run
the form on an Android device without any errors.

Just want to make sure about this...

Actually now that I look at it, it does indeed not give me an error when
using on an Android device but the actual distance field has no value. It
seems that it is still not able to calculate the distance, maybe still
throwing error but not showing it.
And the GPS/Location is enabled on the device.

Forgot another thing...
I know for a fact that the GPS location I'm basing the calculation of is
not NULL or empty. I'm displaying the GPS coordiantes in Case Details.

Hi Johann,

The here() function is not yet implemented for Web Apps so unfortunately
the behavior you're seeing on there is expected. You can request this
feature on uservoice https://dimagi.uservoice.com/.

To figure out which part of your expression isn't working on Android, I'd
recommend breaking down your full calculate statement into smaller parts on
the detail screen so that you can see which part is empty or incorrect.

Cheers,
Will

··· On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden wrote:

Forgot another thing...
I know for a fact that the GPS location I'm basing the calculation of is
not NULL or empty. I'm displaying the GPS coordiantes in Case Details.

--
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-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Johann,

To follow up on this we have now implemented a workaround on Web Apps where
here() will no longer crash the app but will instead include a dummy value.
This should allow you to continue using Web Apps to test this form though
you will still not have this functionality.

Cheers,
Will

··· On Fri, Jan 13, 2017 at 2:08 PM, William Pride wrote:

Hi Johann,

The here() function is not yet implemented for Web Apps so unfortunately
the behavior you're seeing on there is expected. You can request this
feature on uservoice https://dimagi.uservoice.com/.

To figure out which part of your expression isn't working on Android, I'd
recommend breaking down your full calculate statement into smaller parts on
the detail screen so that you can see which part is empty or incorrect.

Cheers,
Will

On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden vaneedenj94@gmail.com wrote:

Forgot another thing...
I know for a fact that the GPS location I'm basing the calculation of is
not NULL or empty. I'm displaying the GPS coordiantes in Case Details.

--
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-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Can you provide some documentation on the here() function. I can't seem to
find anything. I want to get the current gps location as a hidden value and
immediately use that data point, rather than having the user record the
location.

··· On Wednesday, January 18, 2017 at 5:21:22 AM UTC-5, William Pride wrote: > > Hi Johann, > > To follow up on this we have now implemented a workaround on Web Apps > where here() will no longer crash the app but will instead include a dummy > value. This should allow you to continue using Web Apps to test this form > though you will still not have this functionality. > > Cheers, > Will > > On Fri, Jan 13, 2017 at 2:08 PM, William Pride <wpr...@dimagi.com > wrote: > >> Hi Johann, >> >> The here() function is not yet implemented for Web Apps so unfortunately >> the behavior you're seeing on there is expected. You can request this >> feature on uservoice . >> >> To figure out which part of your expression isn't working on Android, I'd >> recommend breaking down your full calculate statement into smaller parts on >> the detail screen so that you can see which part is empty or incorrect. >> >> Cheers, >> Will >> >> On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden <vanee...@gmail.com > wrote: >> >>> Forgot another thing... >>> I know for a fact that the GPS location I'm basing the calculation of is >>> not NULL or empty. I'm displaying the GPS coordiantes in Case Details. >>> >>> -- >>> 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. >>> >> >> >

Hi Carolyn,

Unfortunately it looks like this is a gap in our documentation at the
moment. The short answer is that you can add the here() function as the
calculate to a hidden value and this value should be updated in the
background without any user input. The result will be a space separated
string containing latitude / longitude / altitude / accuracy (the latter
two in meters).

I'll add a a ticket for our team to add some official documentation,
apologies for the inconvenience.

Cheers,
Will

··· On Sat, Feb 11, 2017 at 12:07 AM, Carolyn Commons wrote:

Can you provide some documentation on the here() function. I can't seem to
find anything. I want to get the current gps location as a hidden value and
immediately use that data point, rather than having the user record the
location.

On Wednesday, January 18, 2017 at 5:21:22 AM UTC-5, William Pride wrote:

Hi Johann,

To follow up on this we have now implemented a workaround on Web Apps
where here() will no longer crash the app but will instead include a dummy
value. This should allow you to continue using Web Apps to test this form
though you will still not have this functionality.

Cheers,
Will

On Fri, Jan 13, 2017 at 2:08 PM, William Pride wpr...@dimagi.com wrote:

Hi Johann,

The here() function is not yet implemented for Web Apps so unfortunately
the behavior you're seeing on there is expected. You can request this
feature on uservoice https://dimagi.uservoice.com/.

To figure out which part of your expression isn't working on Android,
I'd recommend breaking down your full calculate statement into smaller
parts on the detail screen so that you can see which part is empty or
incorrect.

Cheers,
Will

On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden vanee...@gmail.com wrote:

Forgot another thing...
I know for a fact that the GPS location I'm basing the calculation of
is not NULL or empty. I'm displaying the GPS coordiantes in Case Details.

--
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-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks, Will. Let me know when that documentation goes up. I tried calling
the here() function in the calculate condition of a hidden value. But when
I open the form, I get an error that reads: "Calculation Error: Error in
calculation for /data/here cannot handle function 'here'

··· On Monday, February 13, 2017 at 4:39:38 AM UTC-5, William Pride wrote: > > Hi Carolyn, > > Unfortunately it looks like this is a gap in our documentation at the > moment. The short answer is that you can add the here() function as the > calculate to a hidden value and this value should be updated in the > background without any user input. The result will be a space separated > string containing latitude / longitude / altitude / accuracy (the latter > two in meters). > > I'll add a a ticket for our team to add some official documentation, > apologies for the inconvenience. > > Cheers, > Will > > On Sat, Feb 11, 2017 at 12:07 AM, Carolyn Commons <crco...@gmail.com > wrote: > >> Can you provide some documentation on the here() function. I can't seem >> to find anything. I want to get the current gps location as a hidden value >> and immediately use that data point, rather than having the user record the >> location. >> >> On Wednesday, January 18, 2017 at 5:21:22 AM UTC-5, William Pride wrote: >>> >>> Hi Johann, >>> >>> To follow up on this we have now implemented a workaround on Web Apps >>> where here() will no longer crash the app but will instead include a dummy >>> value. This should allow you to continue using Web Apps to test this form >>> though you will still not have this functionality. >>> >>> Cheers, >>> Will >>> >>> On Fri, Jan 13, 2017 at 2:08 PM, William Pride wrote: >>> >>>> Hi Johann, >>>> >>>> The here() function is not yet implemented for Web Apps so >>>> unfortunately the behavior you're seeing on there is expected. You can >>>> request this feature on uservoice . >>>> >>>> To figure out which part of your expression isn't working on Android, >>>> I'd recommend breaking down your full calculate statement into smaller >>>> parts on the detail screen so that you can see which part is empty or >>>> incorrect. >>>> >>>> Cheers, >>>> Will >>>> >>>> On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden wrote: >>>> >>>>> Forgot another thing... >>>>> I know for a fact that the GPS location I'm basing the calculation of >>>>> is not NULL or empty. I'm displaying the GPS coordiantes in Case Details. >>>>> >>>>> -- >>>>> 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. >> > >

Hi Carolyn,

That sounds like it should be working - could you report a bug from your
domain so that we can take a look?

Thanks,
Will

··· On Mon, Feb 13, 2017 at 5:08 PM, Carolyn Commons wrote:

Thanks, Will. Let me know when that documentation goes up. I tried calling
the here() function in the calculate condition of a hidden value. But when
I open the form, I get an error that reads: "Calculation Error: Error in
calculation for /data/here cannot handle function 'here'

On Monday, February 13, 2017 at 4:39:38 AM UTC-5, William Pride wrote:

Hi Carolyn,

Unfortunately it looks like this is a gap in our documentation at the
moment. The short answer is that you can add the here() function as the
calculate to a hidden value and this value should be updated in the
background without any user input. The result will be a space separated
string containing latitude / longitude / altitude / accuracy (the latter
two in meters).

I'll add a a ticket for our team to add some official documentation,
apologies for the inconvenience.

Cheers,
Will

On Sat, Feb 11, 2017 at 12:07 AM, Carolyn Commons crco...@gmail.com wrote:

Can you provide some documentation on the here() function. I can't seem
to find anything. I want to get the current gps location as a hidden value
and immediately use that data point, rather than having the user record the
location.

On Wednesday, January 18, 2017 at 5:21:22 AM UTC-5, William Pride wrote:

Hi Johann,

To follow up on this we have now implemented a workaround on Web Apps
where here() will no longer crash the app but will instead include a dummy
value. This should allow you to continue using Web Apps to test this form
though you will still not have this functionality.

Cheers,
Will

On Fri, Jan 13, 2017 at 2:08 PM, William Pride wpr...@dimagi.com wrote:

Hi Johann,

The here() function is not yet implemented for Web Apps so
unfortunately the behavior you're seeing on there is expected. You can
request this feature on uservoice https://dimagi.uservoice.com/.

To figure out which part of your expression isn't working on Android,
I'd recommend breaking down your full calculate statement into smaller
parts on the detail screen so that you can see which part is empty or
incorrect.

Cheers,
Will

On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden <vanee...@gmail.com wrote:

Forgot another thing...
I know for a fact that the GPS location I'm basing the calculation of
is not NULL or empty. I'm displaying the GPS coordiantes in Case Details.

--
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.

--
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-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks, Will. I just submitted one.

··· On Monday, February 13, 2017 at 10:45:46 AM UTC-5, William Pride wrote: > > Hi Carolyn, > > That sounds like it should be working - could you report a bug from your > domain so that we can take a look? > > Thanks, > Will > > On Mon, Feb 13, 2017 at 5:08 PM, Carolyn Commons <crco...@gmail.com > wrote: > >> Thanks, Will. Let me know when that documentation goes up. I tried >> calling the here() function in the calculate condition of a hidden value. >> But when I open the form, I get an error that reads: "Calculation Error: >> Error in calculation for /data/here cannot handle function 'here' >> >> >> >> On Monday, February 13, 2017 at 4:39:38 AM UTC-5, William Pride wrote: >>> >>> Hi Carolyn, >>> >>> Unfortunately it looks like this is a gap in our documentation at the >>> moment. The short answer is that you can add the here() function as the >>> calculate to a hidden value and this value should be updated in the >>> background without any user input. The result will be a space separated >>> string containing latitude / longitude / altitude / accuracy (the latter >>> two in meters). >>> >>> I'll add a a ticket for our team to add some official documentation, >>> apologies for the inconvenience. >>> >>> Cheers, >>> Will >>> >>> On Sat, Feb 11, 2017 at 12:07 AM, Carolyn Commons wrote: >>> >>>> Can you provide some documentation on the here() function. I can't seem >>>> to find anything. I want to get the current gps location as a hidden value >>>> and immediately use that data point, rather than having the user record the >>>> location. >>>> >>>> On Wednesday, January 18, 2017 at 5:21:22 AM UTC-5, William Pride wrote: >>>>> >>>>> Hi Johann, >>>>> >>>>> To follow up on this we have now implemented a workaround on Web Apps >>>>> where here() will no longer crash the app but will instead include a dummy >>>>> value. This should allow you to continue using Web Apps to test this form >>>>> though you will still not have this functionality. >>>>> >>>>> Cheers, >>>>> Will >>>>> >>>>> On Fri, Jan 13, 2017 at 2:08 PM, William Pride wrote: >>>>> >>>>>> Hi Johann, >>>>>> >>>>>> The here() function is not yet implemented for Web Apps so >>>>>> unfortunately the behavior you're seeing on there is expected. You can >>>>>> request this feature on uservoice . >>>>>> >>>>>> To figure out which part of your expression isn't working on Android, >>>>>> I'd recommend breaking down your full calculate statement into smaller >>>>>> parts on the detail screen so that you can see which part is empty or >>>>>> incorrect. >>>>>> >>>>>> Cheers, >>>>>> Will >>>>>> >>>>>> On Fri, Jan 13, 2017 at 12:26 PM, Johann van Eeden < vanee...@gmail.com> wrote: >>>>>> >>>>>>> Forgot another thing... >>>>>>> I know for a fact that the GPS location I'm basing the calculation >>>>>>> of is not NULL or empty. I'm displaying the GPS coordiantes in Case Details. >>>>>>> >>>>>>> -- >>>>>>> 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. >>>> >>> >>> -- >> 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. >> > >