LiveCode DataGrid assistance requested
jeejeestudio at gmail.com
Tue May 4 15:21:28 EDT 2021
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,
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode