Creating the Update Transaction

Creating the Update Transaction

Getting started

First create in your site root folder a new file named "update.php". Then go back to the main page ("index.php"), and create a way to edit the information that already exists in the database. Select the table containing the record list and add a column to the right. To do that, select the table last column, press your mouse right button and select the "Table/Insert Rows or Columns" option:

On the second row of the inserted column we'll write "Update" and we'll create a link pointing to the "update.php" file. Being an update page, it needs to know which row to edit. Therefore, we need to pass a variable to this page in order to be able to select the exact row. Select the "Update" text and use the right mouse button. In the displayed menu choose the "Make Link" option and then, in the displayed interface, choose the "update.php" file and press the "Parameters" button that will load a new interface where users can define the parameters to pass:

In the "Parameters" configuration interface define the parameter name as "id_dep" and for the parameter value select the "Value" column and press the "Thunder" icon and then select the "id_dep" field in the dynamic data interface:

As you can see we have defined an "id_dep" variable that contain the id of a selected record from the database.

Save your "index.php" file and upload it on the server.

Before creating the Update Transaction we must create, in the "update.php" file, a recordset which will be used to display the current field values for each database record that we want to modify. This recordset contains a single row, filtered from all the rows using the "id_dep" recordset parameter passed by the browser when the "Update" link is used for a selected record (in our case when we choose to edit a department).

Note: Because the Update Transaction needs the "id_dep" field loaded in the recordset, please make sure you don't modify the fields list when creating the recordset. However, if you do so, please remember to select the primary key of the table in the recordset fields list.

To create the recordset, you have to access the "Bindings" tab from the "Application" panel, press the "plus" button and select the "Recordset (Query)" option. Name the recordset "update", select the "Safe" option from the drop down menu, the "impaktbasics_conn" from the Connection menu and the "departments_dep" table. Choose to display all the columns contained by the selected table, select "id_dep" from the Filter drop down and define the URL Parameter (in our case "id_dep"). Follow the picture below for details:

Now we can create the Update Transaction by using the "tNG Update Form" button from "Insert//ImpAKT2" tab. The transaction name will be "updateTransaction", connection "impaktbasics_conn", table to update - "departments_dep".

We also need to provide some additional information as:

  • Select Record From: this field requires a recordset name which, in our case, will be "update"
  • Unique Key Column: this field requires the unique key for the selected table which, in our case, is the "id_dep" field.
  • Write "index.php" to the "After Updating, Go To" field or use the Browse button to select it from the site file list.
  • Then we choose the "name_dep" field as being required and "budget_dep" as being required and having a "Positive Float" field type.

Finally the dialog box should look like this:

Editing the Update tNG Transaction

The "tNG Update Form" command generate the form, the Update Transaction server behavior, the UniVAL trigger and the Handle error trigger. Each of them are listed in the "Server Behavior" tab from the "Application" panel and they can be edited.

To edit an existing server behavior select it from the list and double click on it. ImpAKT will display a configuration window containing the server behavior current parameters. User can modify these parameters and then press the "OK" button to save them. Don't forget to save the file and upload it on the sever after each modification.

Now save your "update.php" file and upload it on the server.

Adobe acquired InterAKT
InterAKT has been acquired by Adobe.
Learn more
 
© Adobe Systems Romania. All rights reserved.