Create and read multi-dimensional array

Hi Thunkers,

Probably a really simple answer, but how do you set fields within a data viewer?
All tutorials refer to “from X set text items to x” but this option does not seem available, only a block that contain a reference to row_id.

I’m I missing something or this is what we should now use?

Thanks

1 Like

Can you be more specific?
What fields you want to set?

See this example of altering the color of one of the fields in a data viewer

Thanks I’ll give this a go,

1 Like

Ok so I gave the above a go and after hours of testing, I still can’t get it to work!
I’m I missing some fundamentals?

To explain further.
I have created a data viewer and a dummy table with some values in to test the viewer.
I’m attempting to call an API and populate the data viewer fields with the values from the API.
I know the api works as I can populate a simple label with the values. But when I try to populate the data viewer with anything other than values set in the dummy table nothing happens.

I believe I could pump the api data into a table then back out again, but this seems unnecessary especially as all there are so many tutorials demonstrating it is possible to do without!

The example @muneer shared should work but I’m at a loss to why its not!

I have been banging my head against this wall for days!!! What makes it a harder is I haven’t found a way to run traces in trunkable so having to tweak and preview everything!

Any suggestions at where I’m going wrong?

1 Like

If you can show your code, it would be easier to suggest a way forward.

However, if the output of your API is a single field/column then use a list viewer instead.

Arrange the data from your API in a list and view it in a list viewer.

If you are getting many fields/columns from your API then you either save it to a local storage table to view in with the data viewer or use the cloning of the Any component to make your own multi data list.

If you want to use a Data Viewer and fill it dynamically then you have to trick the system in two steps.

  • the dummy table should have a number of rows the same as the rows of your API output
  • only bind one column in the data viewer and leave the other columns unbound to use them to fill your own data

Happy Thunking!

Thanks here’s the problem I’m facing!!

1 Like

First of all, I did not understand why are you calling “getObjects” from inside itself. The position where you are doing this makes no sense to me.

However, the data will not show up in the data viewer simply because the “updateScreen” function uses “j” as the “row id” of the Data Viewer which will result in an invalid “row id” and nothing will get updated.

The other problem in the same function is that you are trying to assign a list to a simple label/picture components.

Happy Thunking!

Thanks!
The getObject call was a mistake on my end where I tried to quickly clean up the code for sharing and made a complete cockup doh!!!
Let me clean it up and re-share, hopefully will make more sense…

This is what I should have sent… I have made tons of versions in the attempt to get something to display.

What would be the best solution to extract the data from the list into the text component?

1 Like

The “updateScreen” still has the same problems.
Variable “j” holds the content of the “dataObject” and you are using it as “row id” for the Data Viewer which will not work.

Ah I see it now. Thanks!

1 Like