Append (QUEL)
Appends rows to a database table.
Syntax
[repeat] append [to] tablename (columnname =
[tablefieldname[[integerexpr]].]fieldname
{, columnname =
[tablefieldname[[integerexpr]].]fieldname})
[where qual]
tablename
Specifies the name of the table to which you are adding rows. This is a 4GL name.
columnname
Specifies the name of the database column to which you are assigning a particular value. This is a 4GL name. It need not be specified if it is identical to the name of the field on the form supplying the data.
tablefieldname
Specifies the name of the table field whose columns supply values for the append
integerexpr
Specifies an expression evaluating to an integer and representing the number of a row in a table field being used in the append statement
fieldname
Specifies the name of the simple field (or column in a table field) that contains the value to be inserted in columnname. When fieldname is a column in a table field, precede it with the name of the table field and a period, as shown in the syntax above.
qual
Specifies a logical expression that restricts the query to certain conditions. It cannot include 4GL names. A qualification clause is also allowed.
Description
The append statement allows you to add rows to a database table, using values from simple fields or the columns of a table field on a form. For maximum efficiency, use the repeat option to repeat an append statement.
A value in an append statement can come directly from the form, or it can be any legal expression, such as the result of a calculation involving a field in the form. In table fields, the value from the current row of the specified column is assumed. To append a value from a different row, specify the row number, enclosed in brackets or a pair of vertical bars, immediately following the table-field name. For example:
append part (partstbl[3].all);
Use append in conjunction with the unloadtable statement to add more than a single row at a time from a table field. For more information, see
unloadtable Statement--Loop Through Rows and Execute Statements.
• A where clause is optional. Note that the qualification function can be used in the where clause.
• The where clause can be stored in a variable. However, in this case, you cannot use the qualification function.
• Queries in which the qualification function is used are not suitable for use as repeated queries. The keyword repeat is ignored if you use it with such queries.
Use the keyword all with either a form name or a table‑field name in place of the list of database column names. For example:
append personnel (deptform.all);
The database table must have a column that corresponds in both name and type to each displayed simple field in the form or to each column in the table field (the mapping ignores local variables).
Examples
Append the values in the current form to the projects table:
repeat append projects (name = projname,
duedate = enddate);
Append the values in Empform to the Employee table, where fields and columns correspond:
append employee (empform.all);
Append the values in empform to the table specified in the field called tablename on the current form (fields and columns correspond):
tablename = "employee";
append :tablename (empform.all);
Append a computed value to the Personnel table:
append personnel (name = name,
sal = salary * 1.1);