Page 1 of 2
Datagrid missing data
Posted: Fri Mar 05, 2021 9:51 am
by istech
Hi All,
I have run into a datagrid problem and I need to know if it is a bug our maybe some other issue. I have used datagrid's for a while now but this issue has me stumped. Currently I have a datagrid that has been set with data. I then update the array and then set the datagrid with the new array. However there is one record which will not display/missing. No matter what I do "Reset" or "Refresh" the new record will not show. I have even done a breakpoint on the missing key during "FillData" but as soon as the draw/fill is complete that new record is lost. I have checked the data is there and is correct in "contents" so not to sure what the problem could be.
Any ideas?
Many Thanks
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 2:43 pm
by stam
Hi istech,
When i've had problems like this before, it's because i forgot the array has to be a numbered array...
I'm sure you haven't done that, can you post the code that updates the datagrid?
S.
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 3:47 pm
by dunbarx
Hi.
You update by setting either the "dgData' or the "dgText" of the group?
And before either of these commands are executed, you are saying, perhaps stepping through, in the line just before, you see the record of interest intact, and yet that single record does not load?
Craig
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 3:51 pm
by FourthWorld
Bonus for setting by dgText rather than array: DG will add the numeric index for you when it converts the text to its internal array format. And you can easily see all of the data in any field if needed.
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 5:07 pm
by istech
stam wrote: ↑Fri Mar 05, 2021 2:43 pm
Hi istech,
When i've had problems like this before, it's because i forgot the array has to be a numbered array...
I'm sure you haven't done that, can you post the code that updates the datagrid?
S.
Definitely a numbered array and checked in the breakpoint to confirm. Very strange. I use the dgdata to set the datagrid as below.
put the cAllData of widget "MyControl" of cd "MAIN" into tAllArray
set the dgData of grp "MyDataGrid" to tAllArray
--dispatch "ResetList" to grp "MyDataGrid"
dispatch "RefreshList" to grp "MyDataGrid"
Definitely a scratch your head moment.
@ Craig, yes I have stepped through the fillData script on the template script and watched the data being filled and the field in question does get populated. But during the (I suppose) refresh of the datagrid the new line gets dropped. Just very strange to see. I'm considering creating a new datagrid to see if the problem exists.
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 5:41 pm
by stam
Not sure if it's any help, but it may be worth checking the dgCache custom property in the data grid property inspector.
This will show you the current dgData of the data grid, would be interesting to know if all the lines you expect are there because your code suggests suggests they should be...
S.
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 5:44 pm
by FourthWorld
It may be useful to see what the DG thinks it's working with, by obtaining the DG's dgText.
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 6:52 pm
by dunbarx
I usually use the dgText instead of the dgData, but I do not think it ought to matter.
It also ought not to matter whether, when stepping through, you see your data either in the clear or in the array variable. If it is there, it ought to stay there.
I have stepped through the fillData script on the template script and watched the data being filled and the field in question does get populated.
What field? I thought we were talking about verifying the contents of a variable JUST before setting the dgText or dgData property of the group, based on that about-to-be-loaded variable.
Craig
Re: Datagrid missing data
Posted: Fri Mar 05, 2021 11:19 pm
by istech
Yes the field is the one I have from the row template. So I put a breakpoint at the row that is missing and the array fills the field for that row. I can see it in the variable view and data is fine. Just gets dropped on the refresh. Which I have no idea why. I'm considered maybe a corrupt array. But even when I delete and recreate the array the same thing happens and it's just one row that is missing. I'll try some more experiments to try and re-create the same issue. But really strange problem.
Re: Datagrid missing data
Posted: Sat Mar 06, 2021 12:04 am
by FourthWorld
Probably not a corrupted array. More likely something in the source data for that record that isn't what you expect.
Re: Datagrid missing data
Posted: Sat Mar 06, 2021 5:32 pm
by dunbarx
Richard may be on to something.
Is it possible, for example, that there is a hidden return char somewhere? That might misalign the relationship among the data.
Craig
Re: Datagrid missing data
Posted: Sat Mar 06, 2021 5:51 pm
by FourthWorld
With no code or data exemplifying the issue shared here, our hands are tied with finding any truly relevant solution.
Re: Datagrid missing data
Posted: Sat Mar 06, 2021 7:38 pm
by istech
Hi All,
I have been doing some testing today and can rule out a data problem. I have recreated the array from scratch and added "NONE" to every data point. I have 16 keys in the array and it only happens when key 16 needs to be applied. If I change key 16 to 17 the data comes through fine. This only happens if the key is 16 in a sequenced run of keys in an array. Just never seen this before.

Re: Datagrid missing data
Posted: Sat Mar 06, 2021 7:53 pm
by dunbarx
Whew.
At least it was not 42.
Craig
Re: Datagrid missing data
Posted: Sat Mar 06, 2021 7:54 pm
by bogs
istech wrote: ↑Sat Mar 06, 2021 7:38 pm
I have been doing some testing today and can rule out a data problem. I have recreated the array from scratch and added "NONE" to every data point. I have 16 keys in the array and it only happens when key 16 needs to be applied. If I change key 16 to 17 the data comes through fine. This only happens if the key is 16 in a sequenced run of keys in an array. Just never seen this before.
I haven't seen this before either, but I have seen something similar in
nature of weirdness when sending to a menu to pick "help" of all things.
The wind up to that one was that you could not just send "Help" because for some reason, Lc internally translated that to "menupick 15" ! I wonder if something similarly goofy is happening here?