I am trying to create an update query but be able to choose the row to be updated by searching for a value (text) in one column of the table and then updating another column. The column to update is Boolean. Is this possible please.
Hi @tonyd ,
Does this start to answer your question?
name: {formtext: name=lookup}
{dbselect: SELECT Name, Count, is_true, rowid() as rowid FROM Table1 WHERE Name=@lookup; space=id; menu=yes}
{dbupdate: UPDATE Table1 SET `is_true`=yes WHERE rowid() = @rowid; space=id; autoaddfields=no}
I have interpreted your formula as:
name: {formtext: name=lookup}
{dbselect: SELECT Colourway, BookPage, is_true, Orders() as Orders FROM Colourways WHERE Name=@lookup; space=02HdgZGm0jNamFkoQbvhd3; menu=yes}
{dbupdate: UPDATE Colouways SET is_true=yes WHERE Orders() = @Orders; space=02HdgZGm0jNamFkoQbvhd3; autoaddfields=no}
On Preview I get:
name:
lookup
Unknown field: is_true. The available fields are: orders, search, bookpage, colourway.
Any suggestions?
I have amended the formula to show the logic I need.I don't need the lookup facility as want to select from existing list. Obviously the syntax is not right as it doesn't work.
{dbselect: SELECT Colourway, BookPage,Orders FROM Colourways; space=02HdgZGm0jNamFkoQbvhd3; name=lookup; menu=yes}
{dbupdate: UPDATE Colouways SET Orders=True WHERE Colourway= @lookup; space=02HdgZGm0jNamFkoQbvhd3; autoaddfields=no}
Basically, I want to select a Colourway from a menu list and have the Orders field set to True for that Colourway. Even better would be to bring up the selected Colourway fields and allow me to set or unset the Orders field.
Do you know if a snippet can update multiple rows in a Data Blaze table in one go