12. Inserting and Deleting Records

Inserting Records

WOW Enterprise Edition [EE] supports the ability to add records with no manual programming required. The WOW Builder allows a user to set automatic updates at the operation level within the display section of the builder, as shown here

By having the updates box checked, an insert button will appear enabling you to enter new data.

The insert button will take you to a screen where you enter in the data as shown below.

Once the data has been entered clicking insert will update the database with the new information.

Auto Increment

When building applications it is likely important that records have a unique number or field. There are two different ways to set an auto increment upon inserting data within WOW. These are WOW Driven and Database Driven.

The WOW framework can determine what the current maximum number is within a table and add 1 to it. For example, consider a scenario where you had an order number and the maximum order number in your database table was: 12345. With WOW Driven auto increment, inserting a new record would result in WOW setting the order number to: 12346

In running a customer application as shown below we want the customer number to be unique. First we need to identify the customer number as a key field, to do this click on the gear icon next to the customer number title.

This will open the field descriptor manager. You must then scroll down to the database settings and change the default key position from 0 to 1, this will tell WOW to recognize this field as a unique key field. Click update and rerun your application.

Now you can see the key icon instead of the gear icon, as shown below.

To set the auto increment, re-open the FD manager By clicking on the key icon. Scroll down to additional settings and find the Auto Increment setting, click on WOW Driven and then update.

Once you have selected WOW Driven Auto Increment, the customer number will be set automatically.

You can now see in screenshot below, that customer number field is not editable because WOW is setting this internally. Each time a new entry is created WOW will add current customer number +1 so no duplicate customer numbers can exist.

A user can also take advantage of database driven auto increment features if available. Modern databases now have the ability to automatically set a unique number when a record is inserted. Details here: http://www.w3schools.com/sql/sql_autoincrement.asp

When a field descriptor has its auto increment setting to: "Database Driven" WOW does not supply a value for this field. All the increment is handled by the database engine not by the WOW framework.

If you have control of your tables, we recommend use of "Database Driven" however many existing tables don't provide this support so "WOW Driven" can be used in these cases.

Deleting Records

EE WOW gives the user control of deleting records from the database. Careful consideration should be given when allowing data deletes. Allowing deletes within operations is set in the display section of the WOW Builder.


By clicking on the red x, a user will be prompted with a warning asking if they really want it deleted. By pressing ok the row will then be deleted.

Basic SQL Queries Using the DELETE Command

[EE] The DELETE statement is used to remove entire rows from a table. The DELETE statement cannot

remove specific columns from a row. If the WHERE statement in a DELETE query is omitted, SQL will

remove all the data in the table.

A simple SQL DELETE statement goes as follows:

DELETE FROM PJDATA.EMPLOYEE WHERE EDLEVEL < ?

Notice the keyword FROM following the DELETE command which specifies which table to delete data from.

In this example, the SQL statement is deleting data from the EMPLOYEE table in the PJDATA schema. The

WHERE clause is extremely important when using the DELETE command. All rows whose EDLEVEL is less

than the value entered at run-time will be deleted from the table.