Also in case the table does have less than 4 rows you will get an error.. you might want to check if the list is long enough before selecting the 4th item
Also the valueIfTagNotThere socket should be a create empty list block rather than an empty text block
SQLite is an actual searchable database using a version of the SQL query language that allows sophisticated searches directly in the DB. https://www.sqlite.org/about.html
You cannot select the list item of an empty string (replace it with an empty list). Also, since you cannot select the list item from an empty list, you need to handle what will happen when the value is an empty list.
IF the value is an empty list
THEN this means that there is no such entry stored.
ELSE if the value is not an empty list
THEN show the information needed.
I looked at some of my old code and I am using some of the same calls so this is puzzling me. Here is the whole thing.
What this does is allow the user to select a name from the list and MapIt. The map features work great.
The import works great and the listpicker works great. What isn't working great is populating the fields.
This exposes a weakness in the use of tables (lists of lists) for storing sparse data.
How do you like having to remember 15 column numbers for the 15 contact fields? Fun, huh? And what if you want to add a new column in the future, and deal with missing columns in old entries?
For that reason, consider storing a dictionary for each contact, with tag = contact name and value = a dictionary with keys=attribute names ("First", "Last",...,"Phone","Notes") and associated values of whatever was in the textbox.Text for that attribute.
Dictionaries don't complain if the associated key/value is missing, they just return whatever default value you sugget.
There is a cost, however.
When you ask for a contact from TinyDB, you should ask for an empty dictionary as a default value, not a 'not found' text, so you can go to work setting key/values in that new dictionary.
If you have old data already in TinyDB, you would have to go back and test if it is a dictionary before trying to get or set key/values. Use the is a dictionary block.
Also, don't get hung up on the idea of displaying your contact details in a spreadsheet format. Retire that fellow sitting on a tall stool with a quill and a ledger book.
I guess I need to figure out how to get my data from Tinydb which is fixed by the way into a dictionary so I can display the information on my contact form.
With further effort, this could be extended to also include new attribute types entered by the user, contact by contact (Left Shoe Size,...)
When an attribute is selected from the ListView for the current contact, the attribute name and value are loaded into the Label and textbox for editting and replacement via the Enter button:
I can't tell you how much I appreciate you helping this old guy out. It's a bugger getting old and when I was younger I used to be a developer.
This is fun learning and I really do want to get better at it. Some things are just harder to grasp nowadays.
I did realize one problem I made. When I imported the CSV file from GOOGLE sheets, each row was added as 1 record with 1 field instead of 15 different fields.
I will take the time and watch your video and look at your code.