Create and delete records
create | delete
To create a record in a specific table by script, specify the corresponding table name in a button after
create
.1
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 expressioncreate 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 letterC
and a UNIX timestamp.
1
let newCustomer := (create Customers);
2
newCustomer.('Customer number' := "C" + number(now()))
Result: A new record in the Customers table with a unique customer number.
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.
1
delete this
Result: The current record is deleted.
To delete several records, combine
delete
with select
.1
delete select Customers where Status = 4
Result: All records in the Customers table with the status
4
are deleted.Last modified 7mo ago