Re: LiveCode DataGrid assistance requested
On 5/4/21 8:26 AM, Brian K. Duck via use-livecode wrote: After adding “Combine array using return,” I can display it as text in a field, but I only get the rows that aren’t array data on their own. So, most of the data is lost. The combine and split commands were written in the dark ages before we had multidimensional arrays. I use recursive repeat loops to untangle multidimensional arrays into an editable text form (pseudocode): put the keys of tArray into tKeys repeat for each line tKey in tKeys if tKey is empty then # see if it's an array put the keys of tKey into tSubArray # recurse to process the array else # it's an actual empty element end if end repeat -- Mark Wieder ahsoftw...@gmail.com ___ 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
Re: LiveCode DataGrid assistance requested
Hi Brian, if you are using LC9.x.x then it is an Datagrid2 automatically. I don't know the exact lc version as of. Make sure that you have the data item which you want to display in a variable first and put that in a test field or answer it, just to check if that is the data you need. There are lot's of examples on the forum on how to get the desired data into the DG, and perhaps it's easier to put a piece of your script over there so people can see what you doing. But you can also post here. So convert JSON to LC array, then get the item into a variable. Set the DGdata to the variable. In other words, test step by step what you have. Op 4-5-2021 om 17:26 schreef Brian K. Duck via use-livecode: Hello listers... I’m working on an app that pulls data from a API which returns JSON and is converted to an array then displayed in a DataGrid. The data returned is complex JSON, there are a few rows that are name value pairs, but most of the highest level rows are arrays, and there are those that are arrays of arrays (of arrays). After adding “Combine array using return,” I can display it as text in a field, but I only get the rows that aren’t array data on their own. So, most of the data is lost. There are challenges, so I have questions…. How best to convert nested arrays to text for displaying the data within a field? And, I’d like to display certain values from the DataGrid in a text field, like the name attribute, a URL…. The data may be in a different position, for different results, but the structures are consistant. Some data are attributes of a key value, some are the key values. What is the best way to traverse the data to find specific values? Also, should I be looking at the datagrid, array, or JSON for the source of these fields? The current goal is an MVP where I’m displaying data, but the larger goal is building an editor to start with the minimal data and allow editing, publising as files, and further down the road submission to and API service for posting. So, guidance on the design with evolution in mind is much appreciated. Also, there is a need to count elements in the array of arrays. The examples I see are oversimplified and don’t sow any details on finding data in array within an array. Is there an example, or reference, that I missed? Also, how can I tell if I’m working with a DataGrid or instance of DataGrid 2? Thanks for your bandwidth, Brian ___ 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
LiveCode DataGrid assistance requested
Hello listers... I’m working on an app that pulls data from a API which returns JSON and is converted to an array then displayed in a DataGrid. The data returned is complex JSON, there are a few rows that are name value pairs, but most of the highest level rows are arrays, and there are those that are arrays of arrays (of arrays). After adding “Combine array using return,” I can display it as text in a field, but I only get the rows that aren’t array data on their own. So, most of the data is lost. There are challenges, so I have questions…. How best to convert nested arrays to text for displaying the data within a field? And, I’d like to display certain values from the DataGrid in a text field, like the name attribute, a URL…. The data may be in a different position, for different results, but the structures are consistant. Some data are attributes of a key value, some are the key values. What is the best way to traverse the data to find specific values? Also, should I be looking at the datagrid, array, or JSON for the source of these fields? The current goal is an MVP where I’m displaying data, but the larger goal is building an editor to start with the minimal data and allow editing, publising as files, and further down the road submission to and API service for posting. So, guidance on the design with evolution in mind is much appreciated. Also, there is a need to count elements in the array of arrays. The examples I see are oversimplified and don’t sow any details on finding data in array within an array. Is there an example, or reference, that I missed? Also, how can I tell if I’m working with a DataGrid or instance of DataGrid 2? Thanks for your bandwidth, Brian ___ 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