Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
timmarsh
Contributor III
Contributor III

Qv12 (Nov 17 SR6) + Gmaps geocode load statement not working

Hi all

I had Gmaps extensions + geocoding working in QV11. However it is not working in QV12 and it seems related to a particular address (?1!)

Here is the URL string and load statement (this works today without the API key).

let noRows = NoOfRows('Facts')-1;

for i=1 to $(noRows)

//    let a=peek('Pt_FNAME',$(i),'Facts');

//       let b=peek('Pt_LNAME',$(i),'Facts');

       //let c=peek(‘ProductSold’,$(i),'Facts');

    let address=peek('City',$(i),'Facts');

    let postcode=peek('Postcode',$(i),'Facts');

  

    If Not isnull(address) Then

    GeocodeResponse:

    Load

    status

       ,'$(address)' as City

    ,'$(postcode)' as Postcode

    ,([result/geometry/location/lat]) as latitude

    ,([result/geometry/location/lng]) as longitude

    ,([result/address_component/country/]) As ISO_Code

    FROM [https://maps.googleapis.com/maps/api/geocode/xml?address=$(address),$(postcode)&region=au&sensor=fal...]

    (XmlSimple, Table is [GeocodeResponse]) Where Not IsNull(address);

ELSE

ENDIF

next i;

Now, like I say, in QV11 this works today as I post this. With and without the sensor parameter.

However, in QV12, it does not.

Stepping through with debug, the first 7 records are null, script works as expected. (Does not call geocode)

I then encounter a not null address of Goonellabah, 2480 which Geocodes ok.

When I get to this record, "Lennox Head, 2478" I get a load statement error (see below): http://maps.googleapis.com/maps/api/geocode/xml?address=Lennox%20Head,2478&region=au&sensor=false

Pasting this string in a browser works, but from QV12 does not. (But does in QV11).

Here's the error dialog output.

Unknown LOAD statment error

GeocodeResponse:

    Load

    status

    ,'Lennox Head' as City

    ,'2478' as Postcode

    ,([result/geometry/location/lat]) as latitude

    ,([result/geometry/location/lng]) as longitude

    ,([result/address_component/country/]) As ISO_Code

    FROM [https://maps.googleapis.com/maps/api/geocode/xml?address=Lennox Head,2478&region=au)]

    (XmlSimple, Table is [GeocodeResponse]) Where Not IsNull(address)

It looks like it's the space in the City, which is weird- is there some difference between Qv11 and 12?

Regardless, how would I escape this?

My environment is QV12 desktop, connected to a corporate QV server (for license key serving). Other apps work fine. On another computer I have, running Qv11, this script works as expected.

The differences here are - Qv12 not working on one computer, QV11 working on another. Same script (from our network), same proxy etc etc.

Have the load statements changed between Qv11 or 12? Am I missing something obvious?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

As a workaround have you tried replacing the spaces with %20? -> Replace($(address),' ','%20'). You might have to encode other characters as well. You could use the MapSubString function for that. See this discussion for the reverse problem: Re: String manipulation



talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

As a workaround have you tried replacing the spaces with %20? -> Replace($(address),' ','%20'). You might have to encode other characters as well. You could use the MapSubString function for that. See this discussion for the reverse problem: Re: String manipulation



talk is cheap, supply exceeds demand
timmarsh
Contributor III
Contributor III
Author

Thanks so much Gysbert - yep, I ended up using a Replace/Trim with %20 but I'll try the MapSubstring. (My source data should only ever have spaces).

Would like to understand why QV12 is different from QV11 tho!

Cheers once again, very much appreciated.


Tim