2 Replies Latest reply on Jan 22, 2013 5:48 AM by jbante

    Parsing info from fmgo12 Location, easy Q

    martinc

      We're working on an app for field guys to collect job data that will be geolocated and tied to some ArcMap stuff.

       

      the location feature stuffs Lat, Log, and elevation into a single field.

       

      What's the best way to parse the Lat and Lon out into respective fields?

       

      In Location we may have +37822267, -121990308,+10.000000

       

      I'd like +37822267 in Lat and -121990308 in Lon

       

      I imagine the comma is the key.. I'm just parse-challenged.

        • 1. Re: Parsing info from fmgo12 Location, easy Q
          databuzz

          This will give you the Lat:

           

          Let ( [

                    t1 = "+37822267, -121990308,+10.000000" ;

                    c1 = Position ( t1 ; "," ; 1 ; 1 ) ;

                    n1 = Length ( t1 )

          ] ;

           

           

          Left ( t1 ; c1 - 1 )

           

           

          ) // Let

           

          and this will give you the Lon:

           

          Let ( [

                    t1 = "+37822267, -121990308,+10.000000" ;

                    c1 = Position ( t1 ; "," ; 1 ; 1 ) ;

                    c2 = Position ( t1 ; "," ; 1 ; 2 ) ;

                    n1 = Length ( t1 )

          ] ;

           

           

          Middle ( t1 ; c1 + 2 ; ( c2 - c1 ) -2 )

           

           

          ) // Let

           

           

          HTH,

          Andrew

           

          FileMaker 12/11/10/9/8 Certified Developer

          Databuzz

          - - - - - - - - - - - - - - - - -

          Phone: +61 2 9484 6565

          Mobile: +61 418 468 103

          Email: andrew@databuzz.com.au

          http://www.databuzz.com.au

          • 2. Re: Parsing info from fmgo12 Location, easy Q
            jbante

            Another option is to turn the comma-delimited list into a return-delimited list using Substitute(), then extract individual values with GetValue().

             

            Let ( [

                      ~location = Substitute ( Location ( ... ) ; "," ; ¶ ) ;

                      ~latitude = GetValue ( ~location ; 1 ) ;

                      ~longitude = GetValue ( ~location ; 2 )

            ] ; ... )

             

            Alternately, you could save yourself the Substitute() step by using LocationValues() instead. This is the solution I normally skip to by default, since LocationValues() provides more details anyway:

             

            Let ( [

              ~location = LocationValues ( ... ) ;

              ~latitude = GetValue ( ~location ; 1 ) ;

              ~longitude = GetValue ( ~location ; 2 )

            ] ; ... )