Page 1 of 1

Problem with datagrid

Posted: Fri Oct 20, 2023 2:09 pm
by CAsba
Hi,
I've been having some problems recently. This is the latest..
On clicking a button 'ShowAllCols'

with script

Code: Select all

set the dgColumnIsVisible ["code"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["description"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["quantity"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["discount"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["price"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["type"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["stock"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["discountedcost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["Min.purchqty"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["costperunit"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["dim1"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["dim2"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["dim3"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cut1"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cut2"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cut3"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["kgspurchased"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["kgscut"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["ltrspurchased"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["ltrscut"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["wastefactor"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["col 23"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["location"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["checkedqty"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["shortfall"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["reasonforshortfall"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["shortfallcost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["markup"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["nominalcost"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["lfs"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["cuttingfee"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["salesdiscount"] of group "DataGrid 2" to true
   set the dgColumnIsVisible ["Discrec"] of group "DataGrid 2" to true
   
I get an error message..

An error has occurred in behaviour for the Column Template
Chunk: error in object expression.

I checked that the DG still has all the columns listed in the script. This button has worked in the past - something has caused it to fail.
I've re-installed LC, re-started Windows.

Any one any ideas ?

I just tried making another button to change status of some of the cols, and it now seems to be working again.

Re: Problem with datagrid

Posted: Fri Oct 20, 2023 3:11 pm
by dunbarx
CAsba.

Are you saying that the issue has (somehow) resolved?

Craig

Re: Problem with datagrid

Posted: Fri Oct 20, 2023 3:22 pm
by Klaus
Hi CAsba,

you can have it a BIT shorter :-)

Code: Select all

...
put the dgprops["columns"] of group "DataGrid 2" into tColumns
## Returns a CR delimited list of all column names
repeat for each line tColumn in tColumns
   set the dgColumnIsVisible[tColumn] of group "DataGrid 2" to true
end repeat
## Done!
...
Best

Klaus

Re: Problem with datagrid

Posted: Fri Oct 20, 2023 4:29 pm
by CAsba
Yes, Craig.
Thanks Klaus.