Save and display all records in a dictionary question

First thinks to all the help from everyone.
I am learning about dictionary , tinydb.

How can i show all the records from the tinydb in my list view.


and retreiving.

Looks like i am overwriting the tinydb each time i add a new entry.

Thanks for any help and comments.

You need to give each job a unique identifier and store them by that in your database.

with your code, you can only save one user's jobinfo.
if want to save more use's jobinfo, try to save the info under a different tag (i.e. userName)

OR, your current dictionary into bigger dictionary. jobId as key and your current dictionary as value.

Everytime when you save info in tinydb try to save with tag+counter. So easily you can recover it using the same blocks.

When button clicked, get length of tinydbtag on any global variable1

Save value in tinydb tag JobInfo+global variable 1
Value {as usual}

Also while retrieve , when value not found instead of using text pls use create empty dictionary. Beacuse you are saving the value as dictionary mode. Also you must initialise the globalJobinfo variable with create empty dictionary.

This is just and idea , that's all.

If you want to print all the user name in single lable then above method is no use. I will share it later

How would you keep multiple days' jobs?

Could the same vehicle be used for multiple jobs in the same day by different people?

Here is a proposed numbering system for jobs, to give each job a unique TinyDB tag:

  • yyyyMMdd1001 for the first job on day MM/dd/yyyy,
  • yyyyMMdd1002 for the second job on day MM/dd/yyyy,
  • ...

This spreads the jobs out to individual tag/value pairs, to cut down on all that list packing and unpacking that would be needed if all the jobs were kept in one long list. under a single TinyDB tag.

as i said early try this as an alternative

in this method, values will not overwritten

Thanks for all the help. I will study this.

Thanks for your help.

I think i am not doing something correct to get the info out of the tiny db.

Thanks for your help.

1 Like

Yes button2 click have the issue..

Also the list view..

As I said early, this method will give you details of single person at a time. If you want all the details then you must use for each items in the list block, that result only you can use it in list view

Still I am not get what you are expecting..

Pls state us, Do you want to retrieve all the users details? Is this app for users or admin?

As per your blocks,
On button2 click it will return last item value in global Jobsinfo but the problem is you are trying to get value on the same variable. It shouldnot. Use another one globale variable in which you call the value when button2 clicked. (remember it will return the last saved value, if you want all details use for each items in the list block)

Thanks for your help. I will look at this after work today.

Thanks for your help Works great

1 Like

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