DataGrid Error, Can't add array to scalar

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

DataGrid Error, Can't add array to scalar

Post 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
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post 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
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

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

Post 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
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

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

Post 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:
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

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

Post 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
Last edited by mrcoollion on Sat Jan 07, 2017 9:12 pm, edited 1 time in total.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus »

Very good catch, Paul! Please consider to file a bug report here: http://quality.runrev.com
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

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

Post by mrcoollion »

Bug has been filed so they can keep track of it.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus »

Great, thank you!
jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 494
Joined: Thu Sep 04, 2008 6:23 am

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

Post by jameshale »

?? I read syrup saying the problem was in his Data Grid Helper, nothing to do with LC.
mrcoollion
Posts: 744
Joined: Thu Sep 11, 2014 1:49 pm

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

Post by mrcoollion »

Correct.... still annoying if the cause of the problem is not known. :shock:
Post Reply