This site has been archived. Please visit help.fulcrumapp.com for our new support documentation and contact information.

auto populate with Lat Lon

waiotahi's Avatar

waiotahi

15 Dec, 2016 07:29 PM

Hi there
I am wanting to auto populate a field with lat lon (not current position) from a previously entered choice value and am wondering what the best way is to go about this. I'm currently using your geospatial expressions to calculate nearest values so I already have those points as Geojson.
Workflow would be
*create new record
*choose a name from a classification list of 2 -300 entries (also have these names/position as Geojson)
*auto populate Lat Lon fields for that entry

Thanks in advance
Simon

  1. 1 Posted by Bryan McBride on 15 Dec, 2016 07:55 PM

    Bryan McBride's Avatar

    Hi Simon,

    I think I understand what you are trying to do... You need to do a lookup from the choice list against your GeoJSON file to get the coordinates, and then set the geometry to those coordinates, correct?

    Bryan

  2. 2 Posted by waiotahi on 15 Dec, 2016 08:11 PM

    waiotahi's Avatar

    Hi Bryan

     

    Thanks for the prompt reply

    Yes, I want to do a lookup from the choice list against the geojson file to get the coordinates and have those coordinates populate Lat Lon fields within the form

     

    Simon

  3. 3 Posted by Bryan McBride on 19 Dec, 2016 03:16 PM

    Bryan McBride's Avatar

    Hi Simon,

    I put together an example demonstrating how this could be accomplished with data events: http://developer.fulcrumapp.com/data-events/examples/geojson-choice.... Hope this helps!

    Bryan

  4. 4 Posted by waiotahi on 11 Jan, 2017 10:04 PM

    waiotahi's Avatar

    Hi Bryan

     

    Happy New Year – I’ve finally got around to testing the script you’ve put together but have to admit that I’m struggling with getting it to work – mainly due to my lack of programming skills!

    I’ve made a simple app (‘Choice list test’ – under our account) using the code in the example but to be frank I’m not entirely sure what I’m looking at in the code – Are you able to step me through it?

    Thanks in advance

     

    Simon

  5. 5 Posted by Bryan McBride on 12 Jan, 2017 03:25 PM

    Bryan McBride's Avatar

    Hi Simon,

    I took a look at your app and just had a quick question. Should the data
    event be updating the location of the record from the GeoJSON feature, or
    just setting the Lat/Lng values in some text fields you've created?

    *Bryan McBride* | *@**brymcbride*
    *Fulcrum | @fulcrumapp*
    [email blocked]
    +1.518.451.6041

  6. 6 Posted by waiotahi on 12 Jan, 2017 08:30 PM

    waiotahi's Avatar

    Thanks for the prompt reply

     

    Ideally we would like the app to update the record

    * Create new record – Lat/Long automatically captured where the record was made

    * Choose site from pick list/choice list in Geojson

    * App automatically updates previously captured Lat/Long to new Lat/Long from site chosen from Geojson feature collection

    * New Lat/Long now show record in that position on the map

    * It maybe useful for validation purposes to keep the original Lat/Long but not absolutely necessary

    Thanks

    Simon

  7. 7 Posted by Bryan McBride on 12 Jan, 2017 10:40 PM

    Bryan McBride's Avatar

    I updated your app to do what you've outlined. Have a look at the data
    event code.

    *Bryan McBride* | *@**brymcbride*
    *Fulcrum | @fulcrumapp*
    [email blocked]
    +1.518.451.6041

  8. 8 Posted by waiotahi on 12 Jan, 2017 11:28 PM

    waiotahi's Avatar

    That looks good – exactly what was after – well done!

     

    Is it possible to run more than one data event?

     

    Simon

  9. 9 Posted by Bryan McBride on 12 Jan, 2017 11:51 PM

    Bryan McBride's Avatar

    Great! Yeah, you can script multiple events all in that same code block.
    You should be able to copy and paste most of that code, but let us know if
    you need more help.

  10. 10 Posted by waiotahi on 13 Jan, 2017 09:05 PM

    waiotahi's Avatar

    Thanks Bryan

     

    I’ve tried copying & pasting the GPS info (data event) into the same code block but it doesn’t appear to be working.

     

    But I’m not sure its as easy as that as I don’t have any GPS info coming through

     

    Simon

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac