Why doesn't this work?

Mike Bonner bonnmike at gmail.com
Sun May 31 15:09:44 EDT 2015


Not to throw more information at an already answered question, but I find
merge() to be tremendously helpful for this type of thing.

Rather than trying to build up a proper URL with & and && etc, set the
string up as a constant or a property contaiing:
constant baseUrl="
http://www.webservicex.net/uszip.asmx/GetInfoByAreaCode?USAreaCode=[[vAC]]
HTTP/1.1"

then its as smiple as
put 805 into vAc
get url merge(baseUrl)

I find this method far easier to understand and read than trying to build
up some obtuse string.  Heck, I even use this method when creating my
properties sometimes.  Its easier for me to type "set the myWhatever of
this card to merge("This is a 2 line [[cr]] string, notice the cr") rather
than set the myWhatever of this card to "this is a 2 line" & cr & "string,
notice the cr"



On Sun, May 31, 2015 at 11:20 AM, Mark Schonewille <
m.schonewille at economy-x-talk.com> wrote:

> Bill,
>
> If I run this script in a button
>
> on mouseUp
>      put "805" into vAC
>      put URL ("
> http://www.webservicex.net/uszip.asmx/GetInfoByAreaCode?USAreaCode=" &
> vAC) && "HTTP/1.1"
> end mouseUp
>
> I get...
>
> <?xml version="1.0" encoding="utf-8"?>
> <NewDataSet>
>   <Table>
>     <CITY>Woody</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93287</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Acton</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93510</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Arroyo Grande</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93420</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Arroyo Grande</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93421</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Arvin</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93203</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Atascadero</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93422</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Atascadero</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93423</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Avila Beach</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93424</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Bakersfield</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93301</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Bakersfield</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93302</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Bakersfield</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93303</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Bakersfield</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93304</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>
>
> [snip]
>
>
>     <CITY>Goleta</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93199</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Grover Beach</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93433</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Grover Beach</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93483</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Guadalupe</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93434</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
>   <Table>
>     <CITY>Harmony</CITY>
>     <STATE>CA</STATE>
>     <ZIP>93435</ZIP>
>     <AREA_CODE>805</AREA_CODE>
>     <TIME_ZONE>P</TIME_ZONE>
>   </Table>
> </NewDataSet> HTTP/1.1
>
> ...which I think is what you'd expect.
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Installer Maker for LiveCode:
> http://qery.us/468
>
> Buy my new book "Programming LiveCode for the Real Beginner"
> http://qery.us/3fi
>
> LiveCode on Facebook:
> https://www.facebook.com/groups/runrev/
>
> On 5/31/2015 18:55, Bill Vlahos wrote:
>
>> Unfortunately neither of these suggestions work. LiveCode doesn’t like
>> the parenthesis.
>>
>> I also tried using quote & syntax and that didn’t work either.
>>
>> Bill
>>
>>  On May 31, 2015, at 9:34 AM, Mark Schonewille <
>>> m.schonewille at economy-x-talk.com> wrote:
>>>
>>> Bill,
>>>
>>> It doesn't work because LiveCode first parses "url [the url]" and then
>>> concatenates the subsequent strings. Try using parentheses:
>>>
>>>    put "805" into vAC
>>>    put URL ("
>>> http://www.webservicex.net/uszip.asmx/GetInfoByAreaCode?USAreaCode=" &
>>> vAC) && "HTTP/1.1"
>>>
>>> --
>>> Best regards,
>>>
>>> Mark Schonewille
>>>
>>> Economy-x-Talk Consulting and Software Engineering
>>> Homepage: http://economy-x-talk.com
>>> Twitter: http://twitter.com/xtalkprogrammer
>>> KvK: 50277553
>>>
>>> Installer Maker for LiveCode:
>>> http://qery.us/468
>>>
>>> Buy my new book "Programming LiveCode for the Real Beginner"
>>> http://qery.us/3fi
>>>
>>> LiveCode on Facebook:
>>> https://www.facebook.com/groups/runrev/
>>>
>>> On 5/31/2015 18:29, Bill Vlahos wrote:
>>>
>>>>     put "805" into vAC
>>>>     put URL"
>>>> http://www.webservicex.net/uszip.asmx/GetInfoByAreaCode?USAreaCode="
>>>> & vAC && "HTTP/1.1"
>>>>
>>>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list