Looping through Tinydb

I have a small database and want to know if this is possible.

Enter last name and loop through Tinydb until I find the match.

I can click to the next record just fine, but want to be able to enter a name and have it select that record.

Is this possible? I am still looking at the tags to see what I could use.

Thanks

Something like this:

1 Like

Thank you Tim. I'll give this a go. I miss the old Do While statement from the past. :slight_smile:

There is such an event block available, but you need to use it wisely and carefully, it is very easy to create infinite loops (and crash your app) with it. Hence the generally used preference of for each and if.

image

I have done that more times than I will admit in my old days. LOL

Thanks

Theoretically and above all, it is not logically correct, yes we know that TinyDB is a close neighbor of app in AI2 context, but principally it is a DataBase in all. And we need always to reduce the DB call.

Populate list-variable with tinydb-value a list in this case and can be iterated to process it, a variable is heart of program not a distant neighbour - TinyDB, which shouldn't be used in looping.

1 Like

Except that it isn't really a Database, it is a flat XML file. I have requested that TinyDb be served with some Db-like-tools, but the idea was not received with enthusiasm from MIT :grin:

rnareshu,

I think I know what you saying, but Tim's code will work with what I am doing and he has never steered me in the wrong direction.

Seeing how I am not an expert in using AP, I fall back on my old ( I mean old) DB ways of doing things.

I hope, it receive welcome there. :slight_smile:

Yes, I agree with 96% confidence, but still we can call it a database, [it's not my opinion]

Yes, this is how it store its data, as other database systems do have their own data structure, weather it is hierarchical databases, network databases, object-oriented databases, NoSQL databases or even flat file databases. DB data structure is not much our concern, but what protocol/rule/interface we are provided to access them, that makes difference.

Ref: Types of database system | nibusinessinfo.co.uk

well, if you like to use a database, why not using the built in sqlite database?
it already has everything you need...

Taifun

Tim, Thank you again for the help. I was able to modify your code to work with my stuff. It works fast and clean!

Thank you again

1 Like