Retrieve the data in list view

I’m trying to call the same data once I click on one of the items in the list view. Same data has to show up.
How can I expand my list view item so i can see all the data?
here is photo of my beginner code.
2

1 Like

Can you give an example of what you mean? If you select a list item and then display the same data that was already in the list viewer… then nothing changes…?

An example would be something like this…

The list viewer shows:

A
B
C
D

When I click on C, the list viewer should show:

A
B
D

1 Like

I need when i click on item A, it will show the same item A. The idea is i will give more info in the future for the first item. i just need to know based on my code how to make the list viewer expandable with its data.

I still don’t understand.

Maybe you’re wanting to make a drop-down menu?

Or are you saying that when the user clicks on list viewer item A, they then go to a screen with more information about that item?

Yes, I need that

Or are you saying that when the user clicks on list viewer item A, they then go to a screen with more information about that item?

I tried now to navigate with a new screen that has a label to display the clicked item in my list view. It successfully got the entire info of that clicked item, but when i display more items in my list view, it shows all the items in my label.
I only need my label to display the clicked item, not all the items in the list view.
here what i did:

This is my second screen that has a label to display one item clicked, but it shows all items in the list view.

1 Like

How to get my subtree in another word. I’m confused.

First remove the block generate JSON from object. You don’t need it to loop through the data retrieved from Firebase.

Next you need to create a variable and use it in the item click of list viewer.
[The new variable] = [item] which is the green block in the item click block.
Then navigate to the next screen.

In the opens event of screen2 make the label = the variable that contains the “item”.

This will work.

I have tried so many times. Are you able to share with TeamViwer. I would appreciate your assistance

1 Like

No sir, I don’t use TeamViewer.

You have a simple mistake which you can fix without any further assistance.

IMPORTANT
First, remove the [generate JSON from object app variable text] from the loop and instead put the green block [value] from the Realtime_DB1 Get block.

You also need to create a new variable for example myChoice

In the item click block of the list viewer make app variable myChoice = [item] and then navigate to screen2

If you still cannot do it then we find another way.

1 Like

I did what you recommend, it works fine now. The only problem is the getData calls from the firebase is not bringing the all items from firebase. It is showing only repeated first item. I’m one stepper closer to solve that with your appreciate helps. Can you re-take a look to my code. Why the getData calls repeats the first item in the list view?

8

Each time i should click the getData button, it should bring a new item from the firebase. But it is not!
What might be the problem ?
See my output

1 Like

Should I add

RealTime database addlistener once I call the database?

Why the call function is not updating?

1 Like

You removed the loop. This is why you only get 1 item.

First set [app variable listOnj] to empty list then

For each item “j” in list [value] You need this to go through all the items.

It doesn’t work. :pensive: What is wrong
10

1 Like

image

We already agreed it should be [value] in the loop not app variable text.

You need to take out the list viewer text items outside of the loop.

1 Like

We also agreed that the ltem click you should use the [item] green block
image

I did that already. Since my variable listObj is empty. it is showing nothing in the list view now.
Have a look. Also please note, that the

generate Json Object

doesn’t work if i didn’t put it. however I follow exactly your instructions.
Have a look please.

Also item instead of app variable doesn’t work at the item click block.

Does my code working in public? Can you see my code while I’m coding. I notice it says “Public”. If so I guess this my direct link of my code
my coding

1 Like

I created a sample data and sample code
This is the data
image

This is how I retrieve the data

This is when I select something in the list
image

This is the detail screen
image

First screen
image

Next screen
image

1 Like

Thank you so much. Without you, I would still thinking for my entire life.
For learning purposes, what is

// 

at the call realtime_DB1 get function means? Does it mean get whatever in the firebase have?

Also one more question, you put at call database (screen 5) at the key part “join with 1”. Why did you put 1 in that?

1 Like

I made the sample project to use // because you added your data directly to the root of the database. You should first create a master bucket and then add your data under it such as this

image

Another issue is the way I retrieve data from Firebase in Screen5 is not the standard format and this is because of the differences between Firebase and Thunkable.

In Firebase, lists start from 0 but in Thunlable lists start from 1. So when you select index = 1 it means the first item in the list but in Firebase the first item is number 0 so I have to take the index and subtract 1 from it to get the correct value from the database.

However, there is another problem with Firebase and that is the KEY in the GET block should be text not number so I have to use the join text to convert the number into text to make it work with the GET block.

Hope this makes things clear.