How to scan rows in a dataviewer list

I have a dataviewer list.
Clicking on an item, I modify some values of a label in that Item.
Now I would like to scan every items to search if the label has a certain value and do something if so.
Unfortunatelly It’s not clear to me how to do it.
Are every single element of a dataviewer list rows?
This is what I’m doing but i get a single iteration for a 3 items list.


And this is the project.
https://x.thunkable.com/copy/53143abfe36ba69fe05c12944cfd0429
thank you!

1 Like

The problem is that the value I’m looking for is not in the source table.
Is a Value I apply to the item basing on a user interaction.

1 Like

Are you saying that you’re changing the displayed value in the dataviewer list without changing the attached database? You probably shouldn’t do that. @codeswept’s blocks should work if the data is in the source table.

Can you show the blocks you’re using to apply the value to the item based on user interaction?

3 Likes

As @tatiang said you should not change something in the DVL directly and the best practice is to change the database values.

However, this code is changing the image of the DVL outside of the database and it works with me.

image

1 Like

Recap:
I have a list of rows, In every row there is a Label taking it’s text from a DB and a flag to select some specific row, then I should take the selected rows to something.
The flag is not taken from DB but is applyied by user when clicking.
No sense to have it stored in the DB. I can do it, but it has no sense.
Clicking the button I would like to change the button background color and the text of the button.
In my past version I cloned row to have a list and all works, but it was slow to crate and fill rows from DB so I’m looking for a faster version and I’m trying with a custom dataviewer list.
BUT
With Dataviewer list It seems not possible to change button properties
This code Cause NO EFFECT


The same thing applied on a label works.
Here is a project with both label and button
https://x.thunkable.com/copy/40bad032babd530db421e02fd5c2067a
So I decided to use a label instead of a button.
All this to explain why I change a value without touching the DB.

I would like to retrieve the flagged rows directly from the dataviewer but As you said, it seems that I can’t do it if I don’t store the flag value in the DB.
Is this the only way? :frowning:

1 Like

When I preview your project, I can click and change the data viewer 1 at the top (a, b, c) and see the color/text changes:

But not the data viewer 2 at the bottom (label, label, label). That one has errors:

1 Like

Just reselect the dataviewer element, maybe it’s due to a change of the position of the button si the Dataviewer seems different and it has to be relinked

1 Like

I tried that and couldn’t get Data_Viewer_List2’s color/text to change. I’m not sure why.

2 Likes

The Button can not be part of the Data Viewer components. If you add it to the DVL it will not trigger the item click event when you click on it. This is why you do not see it functioning.

Similar problem even using a switch. It doesn’t trigger the item click event and it switch value of ALL switches at a time.
However, maybe it’s better to discuss it on teh specific topic

For now, it seems there is no way to scan items of a list out of a Data Source scanning and using a boolean object so I MUST insert the “boolean” value in the data source table and display it as a label.