Ok, I copied this post made by a member in another thread but that thread was primarily based on an updatable grid and this excerpt is actually closer to my goal. I started to post this in THAT thread but I firmly beleive that there are others who want to do EXACTLY what I am asking and I think this warrants it's own post. I hope it helps me as well as others.
So the scenario is a typical grid with an editable detail view and the checkbox selector option has been chosen in the properties of the grid.
The goal is that for each row selected I want to be able to update a column "is_active" = 'No' using a button that performs an ajax callback and executes some update sql statement.
SO if I were to write semi-suedo code that worked it might look like this
function changeactive as c (e as p)
args.array = the primarykey for each checked row in an array.
args.set("newval",e.dataSubmitted.Is_Active)
sql = "update mydatabase.table SET Is_Active = :newval WHERE pk IN (:argsarray)"
cn.open("::Name::Connection1")
cn.execute(sql,args)
cn.close()
Refresh the grid
end function
I hope that makes sense, so I came across the below code and have tried my best but cannot figure out how to modify it to do what I want.
which is as I said, check a bunch of rows, click a button and set a value of one of the fields - submit it and refresh the grid!
Can anyone give me a hand and post a proper solution/example (using the below code or otherwise...)
So the scenario is a typical grid with an editable detail view and the checkbox selector option has been chosen in the properties of the grid.
The goal is that for each row selected I want to be able to update a column "is_active" = 'No' using a button that performs an ajax callback and executes some update sql statement.
SO if I were to write semi-suedo code that worked it might look like this
function changeactive as c (e as p)
args.array = the primarykey for each checked row in an array.
args.set("newval",e.dataSubmitted.Is_Active)
sql = "update mydatabase.table SET Is_Active = :newval WHERE pk IN (:argsarray)"
cn.open("::Name::Connection1")
cn.execute(sql,args)
cn.close()
Refresh the grid
end function
I hope that makes sense, so I came across the below code and have tried my best but cannot figure out how to modify it to do what I want.
which is as I said, check a bunch of rows, click a button and set a value of one of the fields - submit it and refresh the grid!
Can anyone give me a hand and post a proper solution/example (using the below code or otherwise...)
args.xml = e.checkboxFilterArgumentXML
count = args.count
for i= 1 to count
vKeys = vKeys + args[i].data + CRLF()
next i
argument_add_array_argument(args,"array_vKeys","c",vKeys)
sql = "Select Cnt = Count(*) from InvoiceDex where InvoiceDex_ID IN (:array_vKeys)"
flag = cn.execute(sql, args)
count = args.count
for i= 1 to count
vKeys = vKeys + args[i].data + CRLF()
next i
argument_add_array_argument(args,"array_vKeys","c",vKeys)
sql = "Select Cnt = Count(*) from InvoiceDex where InvoiceDex_ID IN (:array_vKeys)"
flag = cn.execute(sql, args)
Comment