FX Update Multiple Records -
(by Felice Di Stefano)
(support for PHP_MySQL, PHP_ADODB, ASP_Js, ASP_Vbs)
This server behavior will
allow to update multiple records from a table at one time. It can be used
also as a normal update and for complex multi update, assume that the update
do not update only a record at any execution but all records which match
the condition of the Where clause. The restriction is that a recordset must
be always present as a reference.
The main purpose of this behavior is to update all the records from
a list, created by a repeat region, with one click.
Then you may also experiment other solutions at your own risk.
Applying
Create a recordset as your need, then create a form on the page and bind the records to the form elements with a repeat region, add a submit button outside the repeat region. Open the FX Update Multiple Records from the server behaviors palette and apply the parameters. You may use it also with page navigation bar. (It would be recommended to apply the Recordset Repeat Region after the Update Multiple).
| Form: | Select the form which will perform the update. |
| Connection: | Select the connection which must be the same used by the recordset . |
| Update Table: | Select the database table to update. |
| Fields in Loop: | Select the form element to bind to the table column in the dropdown below then select another form element and make a new binding and so on for any element to use in the update action. |
| To Column: | After selecting a field from the list above select a column from this list which will be bound to the selected field then repeat the operation for any field used in the update action. |
| Checkbox Alt Value: | This field is enabled only when the selected element is a checkbox and permit to define the alternative value. 0 or empty string is assumed by default depending on the column definition therefore you don't need to insert the 0. You are free to use any value of course, be coherent with the checked value, if one is Yes the obvious opposite is No, or Accepted and Not Accepted, or 1 and 0 and so on. |
| Referrer Recordset: | Select the recordset used to create the list to update. |
| Where Column: | Select the table column which must be matched by the recordset value, usually a unique identifier as a ID if a single match is required at any loop, but not necessary you can perform complex deleting choosing a column which must be matched by the recordset value. Therefore if you select for example the column ID this will be compared to the ID column of the recordset. |
| Submit Button Name: | Select the button which will submit this action. |
| Redirect To: | At the end define where to redirect after updating, to redirect to the same page you may insert the same page name or even leave it empty. |
Hints
You may use it on a single record.
Since the action is executed at the click of the selected submit button you may combine the update and delete in the same form just selecting a different submit button for any action.
by FELIXONE