populating a datagrid fails in simulator

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stanier25
Posts: 6
Joined: Sun Nov 14, 2010 4:59 pm

populating a datagrid fails in simulator

Post by stanier25 » Sun Nov 14, 2010 5:06 pm

Hi All,

I'm quite new to liveCode so this may well be that I'm missing something obvious! I've got an app the pulls data from a web service, drops it into a field, splits it into chunks then populates a datagrid with the chunks. All works fine in Livecode itself but when I test this in the iPhone simulator (ios 4.1) the datagrid fails to get populated. I can see the data coming in from the web service so I've narrowed the problem down to the data actually being added to the datagrid - I have a separate button that puts an empty array into the datagrid and this fails as well.

The datagrid itself displays fine in the simulator - i.e. if I populate the datagrid in livecode, save the app then run it in the simulator the data shows up.

I need to use a datagrid because the data contains icons as well as text so it appears to be the best control to lay out the kind of data I'm working on.

Any suggestions gratefully received!

edmerckx99
Posts: 8
Joined: Sat Nov 20, 2010 2:32 am

Re: populating a datagrid fails in simulator

Post by edmerckx99 » Sat Nov 20, 2010 2:38 am

i am having this problem as well, is not possible as of yet?

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Location: Fredericktown, MO
Contact:

Re: populating a datagrid fails in simulator

Post by ctflatt » Sat Nov 20, 2010 10:46 pm

Check the other DG post here...

murmac
Posts: 4
Joined: Tue Jan 11, 2011 4:04 pm

Re: populating a datagrid fails in simulator

Post by murmac » Tue Feb 15, 2011 9:29 pm

Hi Stanier,

could you post here an example code to consume a SOAP WS in livecode? I have 4 parameters in my WS with one method, but I don´t know how to implement a request and response code.

Thanks
stanier25 wrote:Hi All,

I'm quite new to liveCode so this may well be that I'm missing something obvious! I've got an app the pulls data from a web service, drops it into a field, splits it into chunks then populates a datagrid with the chunks. All works fine in Livecode itself but when I test this in the iPhone simulator (ios 4.1) the datagrid fails to get populated. I can see the data coming in from the web service so I've narrowed the problem down to the data actually being added to the datagrid - I have a separate button that puts an empty array into the datagrid and this fails as well.

The datagrid itself displays fine in the simulator - i.e. if I populate the datagrid in livecode, save the app then run it in the simulator the data shows up.

I need to use a datagrid because the data contains icons as well as text so it appears to be the best control to lay out the kind of data I'm working on.

Any suggestions gratefully received!

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: populating a datagrid fails in simulator

Post by mvillion » Sat Jun 29, 2013 9:56 am

Hi

This was driving me bananas.

Solution
On card 1 of your stack place a datagrid and hide it.

It will then work.

Go figure.

altschuler.jon
Posts: 6
Joined: Tue Apr 08, 2014 9:12 pm

Re: populating a datagrid fails in simulator

Post by altschuler.jon » Mon Apr 14, 2014 4:05 am

I'm having similar problem: datagrid being populated fine in LiveCode, but fails in iOS simulator.
The data is coming from an API.
I have tried the recommendation of putting a datagrid on card 1 and hiding it, but that didn't work.
Any recommendations for iOS apps that want to use a datagrid?

Thanks,

Jon

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: populating a datagrid fails in simulator

Post by Jellicle » Mon Apr 14, 2014 8:46 am

altschuler.jon wrote: I have tried the recommendation of putting a datagrid on card 1 and hiding it, but that didn't work.
I'm not surprised - that's voodoo.

Tell us more about the format of the data, the kind of data grid and perhaps show us the script you are trying to debug. It's hard to help when someone just says "it doesn't work".

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

peramangk
Posts: 22
Joined: Wed Jul 04, 2007 11:45 am
Location: South Australia

Re: populating a datagrid fails in simulator

Post by peramangk » Mon Apr 14, 2014 11:17 am

When using the simulator, it's handy to use 'answer' commands in troublesome scripts to report back the value of variables, which arm of an 'if' statement is being followed or anything else that might track down the problem.

altschuler.jon
Posts: 6
Joined: Tue Apr 08, 2014 9:12 pm

Re: populating a datagrid fails in simulator

Post by altschuler.jon » Mon Apr 14, 2014 6:46 pm

When you open the card with the datagrid, i load the API url:

Code: Select all

on OpenCard
   put "there is a URL here but I can't seem to include in the forum post" into theURL
    load URL theURL with message "FileIsDoneDownloading"
end OpenCard
When the file is down loading, i manipulate the array to be cleaner for the datagrid. The repeat loop could be my problem, but I haven't found a better way to get the array into the datagrid successfully.

Code: Select all

on FileIsDoneDownloading pURL, pURLStatus
   if pURLStatus is "cached" then
      ## set the text of field "fld_result" to URL pURL
      put URL pURL into tAllCoins
      
      ## put the results of the API call into an array
      put jsonToArray(tAllCoins, true) into gCoinListArray
      put gCoinListArray[results][collection1] into gCoinListArray
      ## put the array into dataGrid format
      
      repeat with x = 1 to (item 2 of line 1 of the extents of gCoinListArray)
         put gCoinListArray[x]["coinID"]["text"] into gCoinListData[x]["coinID"]
         put gCoinListArray[x]["icon"]["src"] into gCoinListData[x]["icon"]
      end repeat
 
      set the dgData of group "dgCoinList" to gCoinListData
      
      ## clear cache when done
      unload url pURL
   else
      put libURLErrorData(pURL) into theError
      set the text of field "fld_error" to "An error occurred:" && theError & "."
   end if
end FileIsDoneDownloading
In the datagrid behavior script:

Code: Select all

on FillInData pDataArray
   set the text of field "coinID" of me to pDataArray["coinID"]
   set the filename of image "icon" of me to pDataArray["icon"]   
end FillInData

altschuler.jon
Posts: 6
Joined: Tue Apr 08, 2014 9:12 pm

Re: populating a datagrid fails in simulator

Post by altschuler.jon » Mon Apr 14, 2014 10:56 pm

OK, problem solved, sort of.
Basically I was using the load command with a callback script that uses "pURLStatus" which apparently is only useable on desktop. On mobile you need to use a callback script of "on urlProgress".

FACEPALM.

J

Post Reply

Return to “iOS Deployment”