Page 1 of 1

DataGrid Error, Can't add array to scalar

Posted: Thu Jan 05, 2017 7:51 pm
by mrcoollion
I was so happy to work with datagrids. However I now get an error which I cannot find the probable cause for.
The error message is : An error has occurred in behavior for the column template. Can't add array to scalar.

Anybody has an idea why I get this error? And how to solve ?
Livecode 8.1.1

When i go to the script it opens at line 3883 (_table.DrawColumns) with code

Code: Select all

 if pIndexesToDraw is not empty then
Regards,

Paul

Re: DataGrid Error, Can't add array to scalar

Posted: Thu Jan 05, 2017 8:14 pm
by Klaus
Hi Paul,

I have seen something like this in the past and the only way to get rid of this was to
delete the datagrid (maybe copy all relevant scripts beforehand!), quit, restart LC
and create a new datagid!


Best

Klaus

Re: DataGrid Error, Can't add array to scalar

Posted: Thu Jan 05, 2017 8:21 pm
by mrcoollion
Thanks Klaus,

I was already preparing to do so ... Already lost few hours trying to find the cause....
I will post I that works...

Paul

Re: DataGrid Error, Can't add array to scalar

Posted: Thu Jan 05, 2017 9:24 pm
by mrcoollion
Created a brand new DataGrid including giving it a new name.
problem still there :(
if I update the DataGrid with code

Code: Select all

set the dgData of group "DataGridName" to AllDataGridDataArray

There is no problem. So for now I will use this...

Code: Select all

 dispatch "AddData" to group "DataGridName" with LineDataArray, tNumberOfTheLine
Still gives problems :roll:

Re: DataGrid Error, Can't add array to scalar

Posted: Sat Jan 07, 2017 7:34 pm
by mrcoollion
After a lot of testing together with zryip theSlug who has built DGH (DataGrid Helper) the cause of the problem was found.
This is what i have been told.
So, the problem is exactly located in the fixed row height property. In your datagrid table it was set to false, and for any new fresh datagrid it is set to true by default.
When you created the datagrid for scratch you probably set the fixed row height to false.
This is the solution you can share in the forum. The cause is DGH is displaying by mistake the property for tables and for forms. DGH will be updated for removing this option for tables.
2. The datagrid library is taking care of variable row heights only for datagrid form not for table. The issue we have with the "fixed row height" property seems to confirm that. And when we are observing the property in the inspector, it only appears for datagrid form.
I've never noticed that when I built DGH. In a next version I will display the property only for forms.
So for a table style datagrid keep the fixed row height property to true.

If all else fails you might want to try to do the following (not sure it will work in your case)
Do not forget to save the script you have got within the DataGrid somewhere else. Will probably save a lot of time later!
Part 1 (Clone part of your DataGrid to a new DataGrid)
- set up a new DataGrid.
- Select (have focus on) the DataGrid with the issue
- In DGH open the "Mimetism" topic
- Add your project datagrid in the "cloning chamber" by clcking on the button with the '...' and then select '' Add in chamber
- Select the fresh datagrid in the new test stack
- In DGH, click on the clone button 'Clone properties & Template'.
- Select the option "Datagrid columns" and only this one (without template and properties)
- Validate with the green button. This will clone the columns only
Part 2 Clone the settings of your new DataGrid back to your DG with the issue.
- Now do the same action backwards but now select the option:
* "Datagrid columns" with template and properties).
* and the option DataGrid properties.
The original datagrid is now based on the fresh datagrid properties. Maybe this helps
DO THIS AT YOUR OWN RISK. So making a backup copy of the stack before is a wise thing to do !! I got a few errors in DGH so I had to save the stack and restart Livecode after which I could do Part 2.

Regards,

Paul

Re: DataGrid Error, Can't add array to scalar

Posted: Sat Jan 07, 2017 8:36 pm
by Klaus
Very good catch, Paul! Please consider to file a bug report here: http://quality.runrev.com

Re: DataGrid Error, Can't add array to scalar

Posted: Sat Jan 07, 2017 9:18 pm
by mrcoollion
Bug has been filed so they can keep track of it.

Re: DataGrid Error, Can't add array to scalar

Posted: Sat Jan 07, 2017 9:32 pm
by Klaus
Great, thank you!

Re: DataGrid Error, Can't add array to scalar

Posted: Sun Jan 08, 2017 12:12 am
by jameshale
?? I read syrup saying the problem was in his Data Grid Helper, nothing to do with LC.

Re: DataGrid Error, Can't add array to scalar

Posted: Mon Jan 09, 2017 7:43 pm
by mrcoollion
Correct.... still annoying if the cause of the problem is not known. :shock: