Lesen mit TinyDB

Ich möchte gerne die Einträge in meiner Db sequentiell lesen.
Leider finde ich nur die Lesefunktion (getvalue) mit der Angabe des tags.
Muss ich tatsächlich erst die tags lesen und dann mit diesen jeweils lesen oder gibt es einen einfacheren Weg?

Use the GetTags blocks, which will return all the tags in your tinydb as a list.
Then you can iterate over this list to view the content of each tag’s value.

(If I remember correctly, the tags may not come back in alphabetical/numerical order, you may need to sort the list first if that is what you need)

My tinydb has three entries
tag value
3 Klaus
1 John
2 Peter

I wanted to read them in the order 1,2,3 and display them in a list, but there is only the first entry read (John) displayed, why?

Hi

Its because the Tags have not populated a List:

TagList01

…but you don’t need the List length:

TagList02

Why not populated by my “for each number…” ? There was one entry displayed.

I wanted to read in key-order (not to sort the items later) so I wrote
“for each number from…”. Therefore I need the highest number (i.e. the number of entries).

what about storing your data as list in one tag in TinyDB only?

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

… “for each number” just gets the next item in the List each iteration. That does not mean the List is in numerical order :upside_down_face:

“for each number”: but I read as often as the db has elements. And every time I read with tag = 1, then tag=2, … so I get them in the wanted order.

store your data in a list like this
John
Peter
Klaus
and the select list item block to get the data, for example index 2 = Peter

Taifun

I have no possibilty to store the data.
I get an unordered DB .

sorry, I do not understand, you might want to elaborate...
Taifun

Pay careful attention to how you design your tags.
Here is a sample project for you …

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.