Problem with datagrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Problem with datagrid

Post by CAsba » Thu Feb 08, 2024 12:20 pm

Hi all,
For some time now, I've been experiencing the data in my 'datagrid 3' not showing, from time to time, as a result of running some code. I thought it might have been my old desktop (Windows) at fault, but it's just happened again on a new laptop (Windows). I had just edited the dg prior to running the code. The code I ran was code I had run numerous times before, without loss of visibility of data. I tried running dispatch "resetlist" to get the data visible but it did not do it. In the past I havr resorted to saved version to get it back but then I lose work done since that version. Also, I would like to build in code to regain the visibility in case it might happen in the standalone.
I tried this

Code: Select all

put ehe dgprops["columns"] of grp  "datagrid 3" into tColumns
 repeat for each line tColumn in tColumns
 set the dgColumnIsVisible[tColumn] of grp "datagrid 3" to true
 end repeat
The columns were shown but not the data.
Anyone any ideas ?

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Thu Feb 08, 2024 12:49 pm

Hi all,
Just found a working resolution; I had forgotten that I had built into the project a datagrid back-up file, to which the dg data is sent prior to processing an invoice (, so that if the invoice is abandoned by the user, the stock is re-adjusted from the back-up file to what it was before the invoicing was started.) By invoking this backup, the text becomes visible.
Of course, this is a workaround - the reason for the non-visibility of the dg text bremains unsolved.

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

Re: Problem with datagrid

Post by stam » Thu Feb 08, 2024 3:20 pm

Just checking: You didn't by chance copy/paste the data grid from elsewhere, or even worse, from another stack?

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Fri Feb 09, 2024 11:43 am

Hi Stam,
No. This is what happens, as far as I can see...
The DG is a list of products, with 35 columns.

A product may have a property of being able to be sold as a cut part of it, for example, a roll of fabric, or not, for example a length of timber where the customer must buy a whole length, even if the cut length(s) required do not constitute the whole length (to stop the user being stuck with an unsaleable short length).

After the system processes a sale (the first line of the invoice) of a whole length cut to size, the system asks if a second product is to be added to the invoice, and it is on the answer "yes" that the problem arises (the DG goes blank), prior to a coded answer dialog.

I should also mention that I keep getting "An error has occurred in behaviour for the column template: Chunk: error in object exppression" I've tried to repress these messages by using "Dispatch resetList" but with only limited success. I just do not understand what 'error in behaviour for the column template' means and it persists even when I re-load Livecode and make a new DG.

Anyone who can unravel all this - I'd be most grateful.

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Problem with datagrid

Post by SparkOut » Fri Feb 09, 2024 1:44 pm

I think we'd need to know the code for handling the "yes" answer you mentioned. It must be affecting the (current) datagrid data or behaviour somehow, and all the resets and refreshes are likely irrelevant. The dgData looks like it has received some incorrect value, eg text where a numerical value is required. It could even be that you have taken the dgText including column names as first row and that's causing errors in the column behaviour which is expecting only the values.
But we need more information.

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Sun Feb 11, 2024 1:17 pm

The visibility-out of the dgtext just happened again, but this time on the first product processing (=first line of invoice), where previously it had occurred on the second. Btw, I'm working in a D: usb, not the C: drive.
I decided to download from LC again in case something had got corrupted, but the installation of the new download did not complete, as, error message, the uninstall part of it could not be installed ! This has resulted in there being no desktop shortcut now, and there appears to be no way to run the stack.
How can I run the stack without the desktop shortcut ?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with datagrid

Post by Klaus » Sun Feb 11, 2024 1:31 pm

Sorry, no idea what you mean with "desktop shortcut" here?
Ah, wait, Windows intallation! :-D

So you have no idea where all of your applications are being installed?
Come on, why not simply search for "Livecode.exe" and create your own shortcut on your desktop?
The app should be somewhere in:
C:/Program Files
or
C:/Program Files (x86)
or even
C:/Program Files/Program Files (x86)
or wherever all of you other applications have been installed, not sure, I'm a Mac user.

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Sun Feb 11, 2024 1:35 pm

No worries, I got it to install version 9.6.9, completeb with new desktop shortcut. Still got the text-visibility-out though.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with datagrid

Post by Klaus » Sun Feb 11, 2024 1:41 pm

OK, but you really should get to know your hard drives content!

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Mon Feb 12, 2024 11:09 am

There is something fundamentally wrong. In Project Browser I selected to put the objects into alphabetical order some weeks ago, which it did, but with a lot of duplicates,; some of the dups had suffixes 0001, 0002, etc., others without suffixes. Some objects do not have duplicates at all. I have been able to delete (clear) some of the dups, others do not respond to right click.
I have now also found that some of the fields with dups do not have the value they have been assigned.
Does anybody have any idea whjat is going on ?

CAsba
Posts: 364
Joined: Fri Sep 30, 2022 12:11 pm

Re: Problem with datagrid

Post by CAsba » Tue Feb 13, 2024 12:05 pm

Hi all,
Thought I'd better let you know that I resolved the problem, it was in the following code:

Code: Select all

if fld "ftype" is "cms" then  
      answer"5555" 
      #####################################################################################code,desc,quan, disc,Price,cost,type,stock,dcost,mpq,  pun, dim1, dim2, dim3, cut1, cut2, cut3,Kgsp, Kgsct,LtsP, LtrsCt,Wfac,Col23,Locn,Chqty,shfl,  reas,sfcsl,mark,NmC,flfs,cfee,Sdis,Discrec,sellpartof
      set the dgProp["column visibility"] of group "datagrid 3" of cd "manage products" to true,true,false,false,false,true,true,true,false,false,false,true,false,false,false,false,false,false,false,false,false,false,false,true,false,false,false,false,true,false,true,true,false,false,true
      answer"5555a"
      dispatch "ResetList" to group "DataGrid 3" of cd "manage products"
      answer"5556"
      exit mouseup
   end if
I played with the project and noted that the hiding of the datagrid text occurred after 'answer"5555a' and before '5556', so I have taken out the line 'dispatch "resetList" etc.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”