Switching delete to write a 1 in hidden column

I don’t want to delete row. I just want to hide it.

so right now, I have 6/11 column names as param when I have selected a row

Param = {
 "ColumnName": self.parent.parent.getchild("Table".props.selection.data[0].Columnname,
.
.
.
"ColumnNameN": self.parent.parent.getchild("Table".props.selection.data[0].ColumnnameN,

}
system.db.runNamedQuery("DeleteSelectedRow", params)

I plan to add a column of Hidden, and I need a script to write a 1 to this column instead of deleting the row.
I just do an insert into query right?
use the params to determine the row in the where clause, and insert my 1 value into the hidden column right?

No, updating a value in an existing row is an UPDATE query. INSERT makes new rows.

Thanks

a button that passes the selected parameters to run an update query is not opening my page up to injection attack right?

In my other queries I can say in the where clause hidden = 0, but will I have to place hidden in the select and then make a subquery to make the query not show that column? Edit: I tested, I can just place it in the where

No, a column can be in the WHERE clause without being in the SELECT item list.

2 Likes

the button runs the script, but the script is never accessible from the page right?
So no risk of injection attack if the button runs an update ?

You are using value parameters in Named Queries? Or “Prep” updates? Then you are fine.

1 Like

I use runNamedQuery and pass the parameters, but the query will be an update type to write the value 1 to the Hidden column which is a bit datatype

system.db.runNamedQuery("HideSelectedRow", params)