wsharba / opendatakit

Automatically exported from code.google.com/p/opendatakit
0 stars 1 forks source link

number(geopoint) returns empty string #1005

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
number(geopoint) should return a number. It returns an empty string,

Original issue reported on code.google.com by yano...@nafundi.com on 20 May 2014 at 7:39

Attachments:

GoogleCodeExporter commented 9 years ago
Looked into this...

The handling/placement of IExprType is entirely broken in the JR code.

It should be an interface on the data returned by the GeoPointData container, 
not an interface on the container itself.

This mis-coding was hidden due to the order if the instanceof tests in the 
XPathFuncExpr class' implementations of toNumeric, toBoolean, toString.

The toBoolean and toString behaviors work as intended just by accident.

Should probably rework all the data types except int, numeric and string (e.g., 
all the date and time types) to use IExprType and should test for this type 
first in the XPathFuncExpr logic.

This is likely why the date-time logic remains completely broken w.r.t. type 
conversions.

Original comment by mitchellsundt@gmail.com on 21 May 2014 at 5:59

GoogleCodeExporter commented 9 years ago
Also faced this issue here needing to check GPS accuracy.  Came up with an ugly 
workaround as:
number(substr(geopoint, string-length(geopoint)-5))

However this only works reliably for accuracy between 10 and 999m

Original comment by peterdcr...@gmail.com on 15 Sep 2014 at 8:00

GoogleCodeExporter commented 9 years ago
Another work-around might be

selected-at(/data/geopoint, 3)

Assuming the geopoint value is converted early to a string, this should pick 
out the accuracy value.

Original comment by mitchellsundt@gmail.com on 15 Sep 2014 at 5:29