Hi all, After much fiddling with the code and looking into the depths of LC core code I've found what happens, and it's all to do with message flow. This way works as expected: 1. I create an array from Data 2. Apply data to DataGrid using set dgData 3. Read from data in the same handler or sub handler using 'put dgData into myArray'
This way sometimes does not: 1. Create an array from Data 2. Apply data to DataGrid using set dgData 3. Read from data in the same handler or sub handler using 'put dgText into myData' This way definitely does not: 1. Apply data to DataGrid using set dgText 2. Read from data in the same handler or sub handler using either 'put dgText into myData' or 'put dgData into myArray' dgText does not get processed from either dgText input or from dgData input during the message flow until it reaches either the end of the entire message flow or a 'Send "myHandler" in 0 sec'. myHandler will be able to read from the dgText because it will have been processed between the original message flow completing and myHandler beginning it's message flow. There does not appear to be a way to force the DG library into processing the cached data from 'set dgData' into the string required for 'get dgText'. So, for my use case, I have switched to creating a simple function to convert the TSV data into an array then apply to the grid as dgData. Then, if I need to read from it in the same message chain/flow I grab the dgData (which is always available unless set to non-persistent) and process the data from the array (which works out better in the long run anyway). Sean On Thu, 25 Mar 2021 at 18:11, Sean Cole (Pi) <s...@pidigital.co.uk> wrote: > Thanks Bob, but the columns are defined, both in my test stack and the > project stack. It gets filled once the scripts have finished running, so it > can't be that which is the issue in this instance. But thanks once again > for your input. > > Sean > > On Thu, 25 Mar 2021 at 17:55, Bob Sneidar via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> DGText will only contain data for the columns you have defined in the >> Datagrid properties. If your dgData array keys have no matching columns it >> will still populate the dgData but dgText will return empty. This is why I >> avoid using dgText at all anymore. >> >> I have also noticed that if one of the row arrays in the dgData is empty >> then that can bork the data grid. You have to set the dgData to empty to >> get rid of it. >> >> Bob S >> >> >> On Mar 25, 2021, at 5:44 AM, Craig Newman via use-livecode < >> use-livecode@lists.runrev.com<mailto:use-livecode@lists.runrev.com>> >> wrote: >> >> I have seen this here and there for years, and having nothing to do with >> dataGrids per se. >> >> A handler will fail to run, but will step through in the debugger without >> issue. This usually resolves, and I never know why. >> >> Craig >> >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode