Update DB on blur(defocus) using current data from a TextInput within a listview

UPDATE: Having toyed around with some stuff, the solution to my problem ended up being temporary states. All reads and writes to the DB are using the DisplayName key as the primary identifier. I have the following set up now:

Textinput1: Label (hidden) = {{querry_readDB.data.DisplayName[i]}}
Textinput1: Default Value = {{Querry_readDB.data.ActiveTicket[i]}}
Textinput1: onFocus set state1 to {{self.label}}
Textinput1: onChange set state2 to {{self.value}}
Textinput1: onBlur trigger querry_writetoDB

Update myDB
set ActiveTicket = {{state2.value}}
where DisplayName = {{state1.value}}

What this is doing is displaying the ticket numbers in editable text fields. Each text field has a hidden property that ties it to the DisplayName. The display names and ticket numbers are indexed to a list view, which has a number of entries equal to {{querry_readDB.data.DisplayName.length}}. When you change the ticket number in the text field, it automatically updates the database then rereads the fresh values. Exactly how I wanted it!

Hey everyone! Totally new to this awesome tool and new to JS in general as well. I've been picking things up pretty quick but I've run into an issue that I can't really figure out.

I have a listview which has many elements within it. One of those elements is a text field. This field is both a data viewing tool and an updating tool. I am filling the default values for all textfields in the listview with the column "ActiveTicket" from an SQL db using {{QReadMyDB.data.ActiveTicket[i]}}. They have the labels listed in a similar way using {{QReadMyDB.data.DisplayName[i]}} I would like to edit this text from textfield1 and update the row in the database associated with the DisplayName of the textfield. I already have the on blur triggering a query to write to the db, but I am having trouble figuring out the syntax to pull data from the edited field and write to the row corresponding to its label (DisplayName). I currently have tried a few variations of the following:

Update myDB
set ActiveTicket = {{textInput1.value}}
where DisplayName = {{textInput1.label}}

So how exactly do I make this query know which DisplayName from the listview triggered the update and only use the values from the textfield with that label within the listview? I hope this all made sense, thanks!

1 Like

:fire: glad temp state ended up working out for you! And thank you for posting your solution :slightly_smiling_face: Let us know if you run into any other questions!