Limit of data in DataGrid ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Limit of data in DataGrid ?

Post by sphere » Wed Jun 03, 2015 9:51 pm

Hi there !

Is there anybody who knows if there are any limits on the DataGrid?

As i want to display a piece of a database.
I'm selecting a table which contains 37 Colunms and 2100 rows of text data.

Now i get every time the error:
An error has occured in behavior for the column template:
Chunk: can't find background

Now i tested it with one column only but with 2100 rows, same error.
When i take a normal field then everything is displayed, so that way i know, getting the data is all ok.

All column names are correct.

Also noticed that once an error has slipped in your datagrid, you can do what ever you want, the error seems to stay in it.
So to test i restart with a new stack every time.

thanks
Sphere

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Limit of data in DataGrid ?

Post by dunbarx » Wed Jun 03, 2015 11:06 pm

Hi.

DG's again. I would not think there is a limit.

I made a test DG with 500 columns and 5000 rows. Random Data. No problem loading that nonsense into a DG. Scrolling worked fine, everything seems OK.

v.6.7.4, OSX10.9

Craig Newman

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Thu Jun 04, 2015 11:28 am

Hi
Thank you Craig.
Then at least i can search elsewhere why it gives an error while loading the data.

Because with an other project i use 5 or 6 columns with 2000 rows and that one works ok, so i thought maybe there is a limit on the columns.

With this last project i let the column names be set via the script and not via the property settings, maybe that that is an issue.

Have to check

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Limit of data in DataGrid ?

Post by Mikey » Thu Jun 04, 2015 3:42 pm

That message is telling you that there is a bug in code (either yours or the dg's behavior code). the dg is written in lc, and it is fairly easy to work on, when you run into something you want to change/fix.

How are you assigning data to the dg. Some code from your project might us help you.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Thu Jun 04, 2015 8:35 pm

i quickly tested again with the code below, this works good. I use this too in an other project.
So in the new one i created there must a fault have slipped in, either in my livecode stack or in the php code

For both i just adjusted the existing one's

now:
I copied the livecode code to this test stack and it gave an error again
So now i'm going to check if it is the php code which is causing the fault or the livecode code

***edit*** i quickly tested some and exchanged some livecode code and this is working ok, so the fault must be in the php code which is causing the grid to error.

Code: Select all

on mouseUp
    put empty into theDataA
   set the dgData of group "DataGrid 1" to theDataA
   
   put "blabla1" & CR & "blabla2" & CR & "blabla3" & CR & "blabla4" & CR & "blabla5" & CR & "blabla6" into tColumns
   set the dgProp["columns"] of grp "DataGrid 1" to tColumns
   
   put URL "http://website.nl/somefolder/getdata.php" into varResults
   set itemdel to TAB
   
    repeat for each line tLine in varResults
       add 1 to tLineCounter
      put item 1 of tLine into theDataA[tLineCounter]["blabla1"]
      put item 2 of tLine into theDataA[tLineCounter]["blabla2"]
      put item 3 of tLine into theDataA[tLineCounter]["blabla3"]
      put item 4 of tLine into theDataA[tLineCounter]["blabla4"]
      put item 5 of tLine into theDataA[tLineCounter]["blabla5"]
      put item 6 of tLine into theDataA[tLineCounter]["blabla6"]
   end repeat
   set the dgData of group "DataGrid 1" to theDataA
  
end mouseUp


sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Thu Jun 04, 2015 9:16 pm

ok i found the issue....
i removed some of the to read tables
and Voila! it works, so these tables are causing a problem

So now adding one by one to see which one it exactly is and then check the database

Thank you all !

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Thu Jun 11, 2015 8:33 pm

I posted the issue i have on stackoverflow.
It seems just using numbers for a column is not going really well. But i did not create the database, so i'm not ging to change it.
See this link for more info
http://stackoverflow.com/questions/3078 ... -2011-from

So the solution is to put in the used PHP script SELECT `2010` FROM blabla_table ORDER BY id.

So the thingy's around the 2010 are not quotes ' but backticks ` you can find them (at least on my keyboard) left to 1. It also has a ~ on the key.

Testing the php script in the browser now did gave the content of the column.

Ok now back to testing with the livecode script :D

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Fri Jun 12, 2015 10:59 pm

Hi,

unfortunately i'm still having trouble with these columns.
Now the PHP scripts work perfectly now.
I only get the id(nummer) and a few year columns. These columns only contain a J or N (Yes or No)

When i put all data into a normal text field then it seems all OK. So that's proof that PHP is working ok and that i can get the data into livecode.
But when i put these columns into a grid then it is error.....
In the livecode script i let the columns names be put in the header of the columns of the datagrid. I also tried with prepared columns names and labels. This makes no difference.
(it works with any other column of this table except for these year columns, also in the databse i see no difference between them and other columns)

anyone has a clue what could be the problem? or how i can check what goes wrong?
Knipsel.JPG
this is the livecode script to put it into the datagrid:

Code: Select all

on mouseUp
      
    put "Nummer" & CR & "2010" & CR & "2011" & CR & "2012" & CR & "2013" & CR & "2014" & CR & "2015" & CR & "2016" & CR & "2017" & CR & "2018" & CR & "2019" & CR & "2020"  into tColumns
   set the dgProp["columns"] of grp "DataGrid 1" to tColumns
   
      put URL "http://somewebaddress/getdata.php" into varResults
   set itemdel to TAB
  
    repeat for each line tLine in varResults
       add 1 to tLineCounter
       put item 1 of tLine into theDataA[tLineCounter]["Nummer"]
      put item 2 of tLine into theDataA[tLineCounter]["2010"]
      put item 3 of tLine into theDataA[tLineCounter]["2011"]
      put item 4 of tLine into theDataA[tLineCounter]["2012"]
      put item 5 of tLine into theDataA[tLineCounter]["2013"]
      put item 6 of tLine into theDataA[tLineCounter]["2014"]
      put item 7 of tLine into theDataA[tLineCounter]["2015"]
      put item 8 of tLine into theDataA[tLineCounter]["2016"]
      put item 9 of tLine into theDataA[tLineCounter]["2017"]
      put item 10 of tLine into theDataA[tLineCounter]["2018"]
      put item 11 of tLine into theDataA[tLineCounter]["2019"]
      put item 12 of tLine into theDataA[tLineCounter]["2020"]
      
      
   end repeat
   set the dgData of group "DataGrid 1" to theDataA
      end mouseUp
Thanks for any help on this.

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: Limit of data in DataGrid ?

Post by Newbie4 » Sat Jun 13, 2015 12:39 am

As an alternative, you can do this:

Code: Select all

set the dgText ["False"] of group "DataGrid 1" to varResults
instead of this in your code

Code: Select all

set the dgData of group "DataGrid 1" to theDataA
By the way, do you ever initialize your line counter to 0 (zero)?
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Sat Jun 13, 2015 11:16 am

Hi Newbie4,

i get the same error unfortunately.

no i never did initialize it to 0, i will try if that will help.

Thanks.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Sat Jun 13, 2015 1:26 pm

If i uncomment the 2 lines which will set the column names and also the repeat structure, then your line ( set the dgText ["False"] of group "DataGrid 1" to varResults) works perfectly.

I i use only the 2 lines which will set the column names and your line (set the dgText ["False"] of group "DataGrid 1" to varResults) then i get an error.

So the DG seems not to like the combination of column names being set in the scriptand filling the columns with data.

So probably for this to solve, i'm going to try to pre-set the column names with the porperty editor and then use your line, see what it does.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?----SOLVED

Post by sphere » Sat Jun 13, 2015 1:41 pm

EUREKA!!!

Whaaaaaaaaaah!!!

Sorry, but it the solution is so simple....i'm almost about to cry......well...ok i won't do that.

Just like in MYSQL it is not allowed(or just not good) to have only numbers in the header, you have to use backticks to be able to get the info.

In the DataGrid it is simply not allowed to have only numbers in the Column Names, so instead of 2015, you have to write Year 2015 in the header.
Else the Datagrid will throw up the error.

So the whole script works, i just have to add Year to all the column names and Voila !

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: Limit of data in DataGrid ?

Post by Newbie4 » Sat Jun 13, 2015 2:20 pm

I am glad you found the solution. Sometimes it gets frustrating. The same happens when you use numbers for the names of buttons. You get strange results.

Did you try your original code to set the data? It should work too. It looked correct.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: Limit of data in DataGrid ?

Post by sphere » Sat Jun 13, 2015 6:20 pm

Yes the original script worked too 8)

I noticed it, i named a few field just with numbers and then Livecode says they don't exist. Thus not allowed. Good to know these tiny things which can cause headaches :twisted:

Thanks!

Post Reply