Datagrid missing data

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

Re: Datagrid missing data

Post by dunbarx » Sat Mar 06, 2021 7:55 pm

Whew.

At least it was not 42.

When you recreated the array from scratch, did you use the original data? Why not create a new with an array of equal size, and with each element just, say, the character "X".

Craig

istech
Posts: 194
Joined: Thu Sep 19, 2013 10:08 am

Re: Datagrid missing data

Post by istech » Sat Mar 06, 2021 9:40 pm

dunbarx wrote:
Sat Mar 06, 2021 7:55 pm
Whew.

At least it was not 42.

When you recreated the array from scratch, did you use the original data? Why not create a new with an array of equal size, and with each element just, say, the character "X".

Craig
Why not 42?

This is the code I used.

repeat for each key tKey in OriginalArray
--if tKey is 16 then
--put "16" into sKey
add 1 to sKey
put trimWS(sKey) into tNewArray[sKey]["data1"]
put trimWS("NONE") into tNewArray[sKey]["data2"]
put trimWS("NONE") into tNewArray[sKey]["data3"]
put trimWS("NONE") into tNewArray[sKey]["data4"]
put trimWS("NONE") into tNewArray[sKey]["data5"]
put trimWS("NONE") into tNewArray[sKey]["data6"]
put trimWS("NONE") into tNewArray[sKey]["data7"]
put trimWS("NONE") into tNewArray[sKey]["data8"]
put trimWS("NONE") into tNewArray[sKey]["data9"]
put trimWS("NONE") into tNewArray[sKey]["data10"]
--end if
--exit repeat
end repeat

The trimWS function is not needed but for troubleshooting purposes added it in.

PS: I have amended the names of the original array/code as this is for a third party and sorry to say can't release the stack presently. However, the help put forward from everyone is well appreciated. Thanks for being a great community.

istech
Posts: 194
Joined: Thu Sep 19, 2013 10:08 am

Re: Datagrid missing data

Post by istech » Sat Mar 06, 2021 10:11 pm

Some more progress on this. With the above code the datagrid is dropping the LAST key. See attached screen shot of the inspectors contents and datagrid.
Attachments
Capture.PNG

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

Re: Datagrid missing data

Post by FourthWorld » Sat Mar 06, 2021 11:17 pm

What does TrimWS do?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Datagrid missing data

Post by dunbarx » Sun Mar 07, 2021 12:13 am

Aha.

So it is not the 16th that matters, but the "last". This seems to me as well to be something in the data.

Why not 42?? Really?? :D

Craig

istech
Posts: 194
Joined: Thu Sep 19, 2013 10:08 am

Re: Datagrid missing data

Post by istech » Sun Mar 07, 2021 1:24 pm

FourthWorld wrote:
Sat Mar 06, 2021 11:17 pm
What does TrimWS do?
function trimWS pText
-- Remove all leading and trailing whitespace characters.
-- I.E., space, tab, carriage return, line feed, form feed.

return replaceText(pText,"(^\s+)|(\s+$)",empty)

end trimWS
@ Craig Nope, What happened here? Key/line 42 had issue's in the past?

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Datagrid missing data

Post by stam » Sun Mar 07, 2021 1:45 pm

istech wrote:
Sun Mar 07, 2021 1:24 pm
@ Craig Nope, What happened here? Key/line 42 had issue's in the past?
or probably a reference to HHGTTG ?

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

Re: Datagrid missing data

Post by FourthWorld » Sun Mar 07, 2021 3:54 pm

Some problems can be solved easily with nothing more than a brief description of the issue. This does not appear to be one of those.

If you can post an example stack with data that exhibits the issue I'll bet we can resolve this quickly.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Datagrid missing data

Post by dunbarx » Sun Mar 07, 2021 6:11 pm

Yes.

It has been a silly running mini-joke on this forum for a decade.

42 is the result of multiplying 6 by 9.

Craig

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Datagrid missing data

Post by stam » Sun Mar 07, 2021 7:31 pm

well, that was one of the questions proposed that gives the answer "42".
Another was many roads must a man walk down before he becomes a man :) And so on...

Context:

In their travels, Arthur comes to learn that the Earth was actually a giant supercomputer, created by another supercomputer, Deep Thought. Deep Thought had been built by its creators to give the answer to the "Ultimate Question of Life, the Universe, and Everything", which, after eons of calculations, was given simply as "42". Deep Thought was then instructed to design the Earth supercomputer to determine what the Question actually is.

If you haven't read the trilogy of 5 books called The hitchhiker's guide to the galaxy your life is incomplete ;)

istech
Posts: 194
Joined: Thu Sep 19, 2013 10:08 am

Re: Datagrid missing data

Post by istech » Sun Mar 07, 2021 8:10 pm

The good news.

I appear to have found a clue to the issue. Not sure if it is a bug or other. Maybe someone can answer. I had the property "fixed row height" selected for the datagrid. As soon as I deselect it the missing row data comes through. I'm sure this is not normal behaviour.

@ Craig - 42!.....Should of got that. Sorry a bit tired today. To be fair not read the books but seen the movie. Maybe time to give the books a go. :lol:

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Datagrid missing data

Post by jacque » Mon Mar 08, 2021 6:14 pm

It's normal behavior. A fixed height means that each row will be the same size. If there is more text than will fit in the height of the row, the extra will fall below the bottom border and you won't see it.

You can fix the problem by ensuring the row height is set to accommodate the largest amount of content you expect. If you do not use a fixed row height then the datagrid has to determine that value itself which can slow down its display.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Datagrid missing data

Post by dunbarx » Mon Mar 08, 2021 6:37 pm

To be fair not read the books but seen the movie.
The movie was awful, the books, especially the first two, are wonderful.

Big difference.

Craig

istech
Posts: 194
Joined: Thu Sep 19, 2013 10:08 am

Re: Datagrid missing data

Post by istech » Tue Mar 09, 2021 12:43 pm

jacque wrote:
Mon Mar 08, 2021 6:14 pm
It's normal behavior. A fixed height means that each row will be the same size. If there is more text than will fit in the height of the row, the extra will fall below the bottom border and you won't see it.

You can fix the problem by ensuring the row height is set to accommodate the largest amount of content you expect. If you do not use a fixed row height then the datagrid has to determine that value itself which can slow down its display.
Thanks for this Jacque, I have reactivated the fixed row height and all appears to be working now. I have spent the last hour trying to recreate the circumstances that caused the issue as I'm uncomfortable giving over an app that could run into this issue along the line. Saying that I have been unable to get the same error/issue reoccur so far.

I'm leaning towards maybe there being a corrupt piece but of data that was entered and that caused the initial issue but this is inconclusive and would prefer finding a concrete reason. So will continue to investigate the core reason for the error/issue and add a little more code to check for corrupt keys/data.

Thanks for your help all and will update if I find a concrete reason on this as to help someone else.

@ Craig - Maybe when I get some free time I'll give the books a go. Maybe year 2042 :wink:

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”