Datagrid content disappeared? Help please.

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Datagrid content disappeared? Help please.

Post by jameshale » Fri Apr 29, 2016 4:16 pm

I have been successfully using datagrids in my app for ages.
All of a sudden one of them has ceased to work.

I have backtracked to earlier versions of my app and they are all exhibiting the same failure with this particular DG.
It is really bizarre as when I open them everything is fine, but if I do something to change the content of the DG it simply vanishes.
Becomes totally empty.

I have been tracing through the script and LC prematurely exits the script at the line setting the dgData of the datagrid.
When I placed this line in the message box I get an error "Chunk: no such object".
I do not know if this is referring to the DG itself or items in its layout.
I have rebuilt the DG and placed the new version on the same card and adjusted the script to set its data.
no joy.

Can any one suggest how I might trace this further?
I have tried stepping into the DG script but that doesn't seem to be an option.

any pointers or thoughts gratefully accepted.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6105
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Datagrid content disappeared? Help please.

Post by FourthWorld » Fri Apr 29, 2016 4:40 pm

jameshale wrote:I have backtracked to earlier versions of my app and they are all exhibiting the same failure with this particular DG.
Same object and same behavior across versions suggests a change in the data.
I have been tracing through the script and LC prematurely exits the script at the line setting the dgData of the datagrid.
When I placed this line in the message box I get an error "Chunk: no such object".
I do not know if this is referring to the DG itself or items in its layout.
What is the line of code that triggers the error?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Fri Apr 29, 2016 5:00 pm

Same object and same behavior across versions suggests a change in the data.
yes, going back and forth it seems that if I start with an empty state I can add one item and all is fine.
If I then add a second item the DG vanishes.
What is the line of code that triggers the error?
This follows a db enquiry.
If I trace to this point the array "theRecordsB" contains what I expect.

Code: Select all

 put theRecordsB into gtheBookList
         set the dgData of group "the_book_list" of stack "program" to theRecordsB
         dispatch RefreshList to group "the_book_list"  of stack "program" 
After the first line in the above, the global "gtheBookList" is also correct.
At the second line "set the ...."
The script debugger throws me out and the handlers "complete" and I am thrown to the card I expect with nothing in the DG.

So yes, it does seem there is something wrong with the data I am at a loss to see it though.
For instance if I repeat what I mentioned above, start empty, add one item then a second but change the item order, I get the same result.
First one OK, second item and DG vanishes.

The data being read in in both cases is the same, just in a different order.

Is there any way of stepping into the "set the dgData of group "the_book_list" of stack "program" .." to see where it goes awry?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5481
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Datagrid content disappeared? Help please.

Post by dunbarx » Fri Apr 29, 2016 6:16 pm

Hi.

If you use the "combine" command and check out the contents of the data, is it still full? If so, try setting the "dgText" instead of the "dgData", and see if it goes through.

There should be no difference whether you use an array or clear data when loading a DG. But sometimes it is easier to see clear data while stepping through the handler.


Craig Newman

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6105
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Datagrid content disappeared? Help please.

Post by FourthWorld » Fri Apr 29, 2016 7:17 pm

Does the array being passed to the DB have keys that are sequential integers?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Mon May 02, 2016 4:57 pm

sorry for the delay in getting back.
I have been able to confirm the data getting through, sometimes.
However, that was not always providing anything showing.
The array being passed does have sequential integers.
I have deleted and rebuilt various versions of the DG with mixed initial success.
Reducing the data to be displayed to only 3 text fields worked for two records, added a third and everything went blank again.
I thought perhaps the extra data I was passing but not displaying was an issue so I reduced the data passed to only what was to be displayed.
Again an initial success (two records) then fail on third.

Now once the DG fails that is it.
I am unable to resurrect it again.
Even if I delete all data being fed to it and start with 1 record I get nothing.
So what ever is taking place really screws something up.
BTW, as the DG is non functional I need to quit the app (and LC) to delete the data folder before re-launching and adding data.

It is as if the DG object/control itself has become disoriented.

This same DG (well before I kept remaking it) has been working perfectly well up until now.
I am trying to work out where I might have made a script change that is causing this but I can't.

The trouble is happening in LC8RC1.
It doesn't happen in LC7.1.4
Unfortunately I have made some significant changes to other aspects of the app in moving from LC7 to LC8
I found 8dp16 stable enough to commence these changes, which include substituting the SVG widget for my interface buttons.
It was only by chance that I discovered the breakdown of the DG in question.

By the way there are two other DGs in the app and they work flawlessly.

I also thought it was perhaps the pref file corruption issue that seems to have introduced some strange things but a standalone I built with 8rc1 also demonstrates the same missing DG. The SVG interface elements look great though.

I am now waiting impatiently for 8rc2 to be released but I fear LC might hold off until they thing they can do a GM.

If I ever get this working again I will post again, or if I decide to go another way I will let you know.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6105
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Datagrid content disappeared? Help please.

Post by FourthWorld » Mon May 02, 2016 5:18 pm

jameshale wrote:The trouble is happening in LC8RC1.
It doesn't happen in LC7.1.4
If you could make a brief example demonstrating that I'm sure the team would be eager to see it with a bug report.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Tue May 03, 2016 9:26 am

OK all is working again.
While working on the example stack to try and replicate the problem I discovered that the presence of an image object in the row template was, temperamental to say the least.
I rebuilt the DG (again) and moved its data setting calls to the card with the DG ensuring the data being set was in fact valid.

Along the way I came across two anomalies for which I entered a QCC report. http://quality.livecode.com/show_bug.cgi?id=17543

I think LC8 is a tad more strict with its keeping tabs on objects (image objects in particular) than previous versions and this may have been the issue.
There also seems to be some problems remaining as mentioned in my QCC entry.

The image object I had in the row template had its filename property left blank only to be set during the DG's fillndata handler.
Once I gave it a default value the problem went away.
This must be new as mentioned before LC7 had no such problems with exactly the same data I am using in LC8.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Tue May 03, 2016 9:32 am

well almost solved.
Make a standalone and the DG draws blank.
getting closer though :?

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Tue May 03, 2016 11:17 am

Spoke too soon.
Adding and deleting records and everything worked as expected.
Quite and relaunched.
Adding records and nothing changed. That is the previously display of records remained unchanged.
Records were indeed added but they did not show either.
Switching active record also did not reflect in the display (it should have changed a text entry.)
It was as if the image of the DG with the initial records was being held in place without change.
Quit and relaunched and now a white blank area (the size of two record entries) where the records were previously displayed.

I am convinced now that there is something amiss with DG in LC8.
Perhaps the errant object ownership I mention in my bug report is pointing at something more sinister.
As now when i trace through the handlers I am able to step over the set the DGData line onto the refresh line and past that.
So the DG is not dying as before when the dgdata was being set but it is not actually updating the DG I am seeing as if it is going elsewhere.

Perhaps I will get an answer from the QCC.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Wed May 04, 2016 5:06 am

prompted by a post to the list I set the variable grevdevelopment to TRUE and went back to my app.

It opens into the script debugger for the "Data Grid" button behaviour of the revdatagridlibrary on trying to draw the DG complaining of a missing image object "dgAlternatingRows".

I went back to a version I had saved when I first got things working again and which only had a single record being displayed.
I added a new record and sure enough, just as the DG was being refreshed I saw the alternating row graphic vanish.
As the DG still has its "Alternate Row Colors" property still set to true it appears the actual graphic has been deleted rather than its content set to empty.

This has to be a bug as there is no way I should be able to affect this.

I have added this to the QCC report to see if this is related to the identity mix up with the row template.
If not I will submit a new QCC.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Wed May 04, 2016 3:12 pm

It is a bug.
Regression introduced in dp16.
Phew!
Now to impress 'put true into grevdevelopment' into my brain before spending 3 days going around in circles.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Datagrid content disappeared? Help please.

Post by jameshale » Fri May 06, 2016 5:11 am

work around but will kill alternating row colors. Note I am on a Mac, not sure if this happens on other platforms.

in the button script of the button "Data Grid" of the stack "revdatagridlibrary" comment out line 8841

Code: Select all

set the text of image "dgAlternatingRows" of me to empty
Somehow this image object has become "lost" and the script bails out at this point.
Comment out the line and all is fine and my DG works as I expect.

revdatagridlibrary is in the package contents of LC8
LiveCode Indy 8.0.0.app/Contents/Tools/Toolset/palettes/revDataGridLibrary.rev

Given this library is quite old (actually in LC 5.5 format) whatever is causing this issue can't reside here but somewhere more recent in the LC evolution chain.
Perhaps this why only this DG and all my attempts at rebuilding it have been affected while my other DG in this app that DOES have alternating row colors works fine. Maybe something in the editing/creation of the row template is deleting this object and this has only recently arisen.

Needless to say I will not be editing my other DG's until this is fixed.

Simon Knight
Posts: 402
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Datagrid content disappeared? Help please.

Post by Simon Knight » Wed May 16, 2018 6:22 pm

Hi,

I have just spent a day pulling my hair out with a similar problem. My datagrid updates some of the time, other times it will update the columns but no data is displayed. Once it is in this state it can not be recovered. I am on a mac with OS Sierra and LC version 9. I used the message viewer and my datagrid stopped at a similar place unable to locate the alternating row graphic.

I have raised a bug report 21286 and will link it to the one referred to above.

One question : how and where is the variable grevdevelopment set ? is it via the message box ? "put true into grevdevelopment" I ask as I feel that my copy of LC is at the mad hatters tea party!
best wishes
Skids

Simon Knight
Posts: 402
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Datagrid content disappeared? Help please.

Post by Simon Knight » Thu May 17, 2018 8:08 am

I have just added the following to the bug report that I submitted :
"I have reviewed the problem and decided that there is a chance that my copies of Livecode have been corrupted: meaning that the graphic that the datagrid uses is missing. So I have downloaded a new copy of LC 9 Indy.

Reviewing my code I have removed the small loop that is run to clear any graphics that were previously loaded before an attempt is made to build the data and display it in a datagrid :

repeat the number of images
delete image 1
end repeat

Could this loop have deleted the alternating row graphic from the DG?

The modified stack code runs without any problems in the new instance of LC 9 indy, populating the DataGrid with out error. This is great but leaves the question of how did the original instance become corrupted and how can LC be protected from such corruptions? "

I would be interested to know if Jameshale's stack (original poster) modified images in any way?
best wishes
Skids

Post Reply

Return to “Talking LiveCode”