Would really appreciate some help with this head scratcher...
1. What is the problem? Be very detailed.
Please see the spreadsheet... geopoint-default.xls (28.5 KB)
It won't convert to xml
I am trying to get a geopoint to load with a default value based on a select_one list. I have stripped out everything else from the form but can't seem to get it to work (I know that I have an additional step in the calculation!). There is bound to be an obvious error in this, even though I have compared with other spreadsheets (including those in the forum that provide similar functionality) that do validate!
2. What app or server are you using and on what device and operating system? Include version numbers.
(I've used a few versions of XLSForm offline including 2.0 as well as the current online converter - v2.5.1) 3. What you have you tried to fix the problem?
Tearing out my hair. After character-by-character typo check of the calculation that is failing:
Changing file type from xlsx to xls, and pretty much anything I can think of that might affect the price of fish.
I removed the calculations and it validates, but doesn't include the latitude and longitude values (from the corresponding columns in the choices sheet) within the part of the xml. Seems odd, but maybe if they're not called anywhere the parser doesn't include them?
4. What steps can we take to reproduce the problem?
Run that spreadsheet through the parser and stand well back...
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
This is the error message:
Error evaluating field 'long' (${long}[1]): The problem was located in Calculate expression for ${long}
XPath evaluation: Instance referenced by instance(paths)/root/item/longitude does not exist
Caused by: org.javarosa.xpath.XPathMissingInstanceException: The problem was located in Calculate expression for ${long}
XPath evaluation: Instance referenced by instance(paths)/root/item/longitude does not exist
... 10 more
The following files failed validation:
${geopoint-default}.xml
In the offiline XLSForm it is the lat calculation that fails, but for the same reason...
Hi @mathieubossaert
Again, finer brains come to the rescue! Merci.
I thought it had to be something simple - all I needed to do was add "true()" to the column choice_filter (even though I looked at that page of the docs and failed to comprehend!). I have uploaded the revised file for clarity in case anyone else finds it useful. geopoint-default-working.xls (26.5 KB)
I would describe this as needing the choice_filter to unlock the "related data" for each choice (I guess what @LN describes as a "secondary instance"), which is a really powerful feature, as we have both discovered! In my case I am using the baseline location data from an audit of path condition (collected using ODK of course!) to simplify recording where maintenance is being done...
All good here (under the circumstances). Your invite remains valid one day we'll be able to travel again maybe...
I have a complementary need close to yours (check on the field the "health" of water level management materials). So as I only need to show the location of the selected to check I am at the right place. I had to add the "maps" appearance to your example to show the default location on a map, and a read_only constraint set to "yes" to adapt and clarify the prompted message "show the Geopoint" instead of "show or modify..." .
The floppy icon remains on the map widget but the location can't be modified.
Here I can see the place I selected (the red circle) and my current location (the blue cross)