Gnome dancing victory dance - datagrids and url

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Gnome dancing victory dance - datagrids and url

Post by Simon » Tue Jan 22, 2013 7:34 am

I'm done...
Anybody else?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Gnome dancing victory dance - datagrids and url

Post by shaosean » Tue Jan 22, 2013 7:50 am

Does open socket work on Android? If so, does that work for you?

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Gnome dancing victory dance - datagrids and url

Post by sturgis » Tue Jan 22, 2013 4:44 pm

Not sure which stack of yours i'm currently using, but it works for me. (just the loading of the data into the datagrid) I emptied the datagrid, simplified your code slightly (got rid of the answers, they were returning the huge long string with your tab replacements and such) tried it on desktop, no problem, tried it on android (after putting a check into the internet box for the standalone settings) ran a test on my kindle and it populated the datagrid exactly as it should.

I also made a super plain stack using the other url that simply returns "here" and tested it. Again making sure the internet checkbox was ticked in the standalone settings for android. The stack has 2 fields and 1 button. 1 field for output, one field for catching any errors, and a button to grab the data. It also works fine, "here" is placed into the output, and no errors are reported.

Attaching both stacks.

Just curious, you have 2.2 chosen as minimum level android. Id your device actually 2.2? I left the setting the same, but i'm testing on a 2.3.3 device so maybe there is a difference there. What device are you testing on? Maybe someone else has one they can test.

Not sure if you have been pointed yet at http://lessons.runrev.com or the scripting conferences, but they're very helpful to fill in any knowledge gaps you may have. Also would recommend reading through the datagrid lessons and api stuff, which is also at lessons.runrev.com.

Here are the 2 stacks.
Attachments
Live_code_problems.livecode.zip
(6.8 KiB) Downloaded 235 times
andtest.livecode.zip
(1.58 KiB) Downloaded 214 times

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: Gnome dancing victory dance - datagrids and url

Post by cusingerBUSCw5N » Tue Jan 22, 2013 5:37 pm

VICTORY! The gnome is conquered.

Two issues were going on here. First, my stupidity. When I did the test stack, there are TWO places in the standalone settings that you have to check for internet access - on the main settings AND in the Android settings. So that's why it wasn't connecting to the Internet.

Now, onto the bigger issue - which I hope will save other people from my big headache.

I have learned that if you put the symbol ^ in the url address it will fail on an Android - and give you the last data that it brought in instead. I was sending the following url address to my server: http://www.mywebaddress.com?email=cjone ... er@aol.com etc - so that the server would send multiple emails. The symbol ^ worked on the IOS and my laptop, but failed with Android. (It gave me whatever data I had asked for in a previous good url call). So I switched all the ^ symbols to ZYP as the delimeter and voila - everything works great (as long as someone doesn't have ZYP in their email address!)

So life is good once again. :D

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Gnome dancing victory dance - datagrids and url

Post by sturgis » Tue Jan 22, 2013 5:52 pm

Ah k. If you were manually choosing inclusions for your app (on the first tab) then yeah you have to make sure you've added the internet library. Otherwise, if you let rev pick inclusions for you only the android checkbox is necessary.

Also, it might help to urlencode things. If you want to send

"email=cjones@aol.com bbaker@aol.com" as 1 paramter you can urlencode it: put ("email=" & urlencode("cjones@aol.com bbaker@aol.com")) into tParameters

which leaves you with the following in tParameters: email=cjones%40aol.com+bbaker%40aol.com

Then catenate the baseurl (including the ? ) together with your urlencoded parameters and it will hopefully work fine on all platforms.

At least I think urlencode is available for android. If its not, easy enough to roll your own. (or in this case just replace space with "+", ignore the rest)

Also was wondering. Rather than return your data with placeholder text for tabs and cr, i THINK (haven't done this stuff in a while) you can just return the actual values and have it work. (Too fuzzy right now to remember for sure)

Post Reply