How to save and display click history using TinyDB and ListView Image?

Hi Koders,

I’m creating an app using Kodular. I have a screen with List_View_Image_and_Text, and when the user clicks on an item, I want to:

  1. Save the clicked data (image, title, subtitle) into TinyDB as a history list
  2. Open a detail screen (Kata_Detail) with that clicked item’s data
  3. Show all previously clicked items on a separate screen (History) using another List_View_Image_and_Text

Here is what I have tried:

  • I used TinyDB.GetValue and TinyDB.StoreValue
  • I stored each clicked item as a list [image, title, subtitle]
  • But the history doesn’t display correctly in the History screen

Can someone please guide me how to store and show click history properly using TinyDB and ListView with Image and Text?

Thank you very much :folded_hands:

History should be a list
To add an item to a list, use the add item to list block instead of the join block
Also the item to add is not the complete list Kamus_Technology, but the item, which has been picked (see the circle in the screenshot)

Taifun

1 Like

Thank you for the help. :folded_hands:
I tried updating my blocks using your suggestion (storing the picked item only, not the whole list).
However, it still doesn’t work properly — the history is not being saved or displayed.


I’ve attached a screenshot of my current blocks for reference. Could you please check what I might be doing wrong?

As mentioned earlier

Taifun

Thank you for the explanation.
I have updated my blocks using add items to list as suggested, and I’m now storing the values properly.
However, it’s still not working as expected.
The history list is not showing or updating correctly.

I’ve attached a new screenshot of my current blocks.
Could someone please check if there’s anything wrong?

I think it is better for you to use a global variable instead of a local variable.

Thanks for your help.
I tried using the global variable as suggested, but it’s still not working as expected.
The history list is not updating/displaying correctly.

No problem with this block.

Make sure you have used name tag name, even single space will make problem. Before clicking the listview debug the tinydb get value block, and after clicking the listview again debug the tinydb so you will be come to know.

Also one more easy methid is there however you created this listview using some global variable. So when listview clicked using the get position, get the clicked index and from thus index take the requited item from the global list and save into tinydb

how to check the listview debug the tinydb get value block, and after clicking the listview again debug the tinydb so you will be come to know?

connect with companion, once web got text use the mouse right click , find the do it option and click and share the result

1 Like

You really should learn to work with lists

Also it helps very much to use Do it to debug your blocks

Taifun

1 Like



tried using TinyDB.GetValue, but it returns an empty list.
It seems that the data is not being stored properly.
Could you please help me check what might be wrong?

See this, it might help you.

1 Like

If helpful, mark as solution

1 Like

Your blocks look correct now
What happens after picking a few items?
How does History look like then?

Taifun

1 Like

After selecting a few items from the ListView Image, the History screen displays the clicked items using the same ListView Image component.

I’m not sure how it works behind the scenes, but it seems to display correctly.
Do you have any suggestions or improvements? :folded_hands:

either share us your sample aia or complete blocks

KamusTerminologiIPADuaBahasa (2).aia (6.3 MB)
“In Screen2, there is a layout called ‘History’ that contains the search history. In the ‘Word Screen’, a ListView Image is used, and when an item is clicked, it will be displayed in the History layout.”

in this screen also using the tinydb for history?

what will happen? in tis scrren you are adding the selected items in history tinydb and populating in a listview in screen2 , once again on clicking the same item present in the tinydb when you click again want to add into the same history tinydb? what is your logic?

i find no issue now. But still i feel surprise how can you make click trigger inn screen2? Felt no such trigger when i click anywhere on the mobile. test this aia but remember i have removed the mp3
KamusTerminologiIPADuaBahas (1).aia (4.4 MB)

1 Like

Each time an item is clicked in the ListView Image, that specific item is saved to TinyDB and then shown in Screen2 using another ListView Image. I am not saving or displaying the full original list — only the items that have been clicked are stored and shown in the history.