Simple addresses on global tinydb

I always have the same problem. But why doesn't this work? I struggle to manage the archive. What I have done trying to simplify all the fields does not work for me.
indirizzi.aia (7.6 KB)

Please show your relevant blocks that are causing your problem, and explain what you are trying to achieve, and what result you expect.

for the moment I'm not doing anything concrete. For now only archive names and addresses. Then I try to add functions. For example groups of names. Then I add again ... to groups I send messages. It's just tests that I do.

Now I find the problem to archive. I write random names (no matter what I write now) - save, but it doesn't work, it gives me error.

I have seen that in some cases temporary archives are used. I don't understand this. I did direct ... I write and save - in theory. Then I have to be able to edit.

I would like to use procedures to reduce the code.

I believe this is an attempt to modify my aia address_1.aia (5.8 KB) provided in difficulty creating an address book. In this in tinyDB is saved a list of lists in which each entry contains name, surname, address, telephone number

On Screen initialize we check tinyDB to see if has values and if yes creates ListView, else you won't see anything

When user fills details and clicks Bt_aggiungi if all details are filled, a list is added to global data, saved in tinyDB and then call a procedure to create ListView since we are working with a list of lists

After an entry is picked, textboxes are populated again in order to make changes

In case we want to delete, we remove entry from global list, save to tinyDB, refresh ListView

image

In case we want to update entry, we replace entry in list, save to tinyDB, refresh ListView

image

I marked some of the problematics parts in your code, For example you set ListView.elements after picking but you have to do it prior when button save is clicked in order to see the listview and be able to choose an entry. Also when button save is clicked you just add items to list but then in salva_elementi you save a list which every time you create a new entry will be overwritten

2 Likes

I really struggle to understand the temporality that you indicate to me. Taking a step back I tried to resume your previous change and I added an email field. But even so it doesn't work for me. In this case what did I do wrong?

Why use a temporary variable?

why when I call a procedure I have to indicate to take the data from global_data (crea_vistalista)? Still in that procedure ... what is the "data" indication next to the procedure name?
indirizzi.aia (8.1 KB)

Whenever you make changes, in order to work you have to clear tinyDB

image

Once I cleared tinyDB and refreshed screen, worked fine

Also try to use Do it to debug your blocks for better understanding the procedures.

you are right. I hadn't done this. But the button change doesn't work ... or rather not as I thought. I select modify having to change the selected contact ... but then being able to modify it safely?

In order to modify you have to replace item in list not add again. Try this way

1 Like

Thanks! You're right!

1 Like