0

Create and delete records

create | delete

create

To create a record in a specific table by script, specify the corresponding table name in a button after create.

Example

create Customers

Result: A new, but empty record in the Customers table.

To fill this new record with data, first store the expression in a variable and then use the variable to access the desired fields.

  1. Initialize the variable newCustomer with the expression create Customer to store the record in the variable.
  2. Access the fields of the new record using the dot operator . and give the new record a unique Customer number consisting of the letter C and a UNIX timestamp.

Example

let newCustomer := (create Customers);
newCustomer.('Customer number' := "C" + number(now()))

Result: A new record in the Customers table with a unique customer number.

delete

Delete records automatically by specifying which records to delete after delete.

Insert the following script in a button to delete the current record.

This is useful for linking the deletion process to another action, such as triggering an email before the record is removed.

Example

delete this

Result: The current record is deleted.

To delete several records, combine delete with select.

Example

delete select Customers where Status = 4

Result: All records in the Customers table with the status 4 are deleted.

Reply

null