Write here your abstract

1 Transactionable forms

Forms are created by attaching a FormDefinition to an EndpointDefinition of type list.

The type of transactions are defined by four important setter methods on FormDefinition:

  1. setInsertCode: Adds an add button to the table
  2. setUpdateCode: Adds an edit button to each row of the table
  3. setDeleteCode: Adds a delete button to each row of the table
  4. addExecuteCode: Adds a execute button to each row of the table

When the insert, edit, or execute buttons are clicked, a form shows up:

2 Insert and Edit transactions

The programming of insert and update froms are very similar. For more details see the API documentation

new FormDefinitionBuilder()
    .setInsertCode("docs_invoice_form", "docs_invoice_ins_trx")

The first argument of setInsertCode (or setUpdateCode) is a SQL catalogued query that defines the fields of the form. The form is made up of each of the fields defined in it's output (wic_sqlc_object_out). The values returned by the sql query will be used as default values of the form.

The second argument (docs_invoice_ins_trx) is the transaction object code (wic_sqlc_trx_ins_head) that will be invoked when the usuer saves the changes. Each of the fields in the form will be sent to the backend and will be used to perform the transaction on the table defined in wic_sqlc_trx_ins_head.

3 Delete transaction

To indicate that the rows can be deleted, the method setDeleteCode must be set.

new FormDefinitionBuilder()

The only argument it receives is the catalogued transaction code. When a row is clicked, a modal window will appear asking for confirmation

4 Execute process

Execute processes are a way to execute XSQL-Scripts from the frontned without the need of performing a transaction on a table. The execution forms are triggered via links attached to the table. When a link is clicked a form is opened, then when the changes are saved the backend process is invoked with the form fields as a parameter.

It is possible to have multiple execution on the same table.

An execution code is set via addExecuteCode on the FormDefinition object. Execution processes work very much like insert o update transactions.

    .addLink("docer", "/form/invoices/{rowid}/action1")
        new FormDefinitionBuilder()
            .addExecuteCode("action1", "docs_invoice_form", "docs_invoice_exe_trx")

The first argument is the path (action1) to which the process is attached. That means that the url /form/invoices/{rowid}/action1 will be mapped to the form, hence the need to attach a link that opens the previous url.

The second argument is the sql catalogued query from which the form is composed, and the second argument is the sql catalogued transaction of type Execute.

Each field in the form is passed to the backend, which then invokes an xsql-script passing the fields as a hashmap paramater

5 Applying conditions to rows

Sometimes a row can be edited or deleted based on some condition. The methods setUpdateCode, setDeleteCode and addExecuteCode can optionally accept a parameter that implements RowCondition interface.

For instance:

.setUpdateCode("docs_invoice_form", "docs_invoice_upd_trx", new RowCondition() {
    public boolean isConditionSatisfied(String user_code, SQLResultSet rs) {
        try {
            return rs.getDouble("impnet") > 0;
        } catch (SQLException e) {
            return false;

The RowCondition object must implement a method isConditionSatisfied which receives the user_code and the SQLResultSet positioned at the row being evaluated. SQLResultSet class is an implementation of standard ResultSet interface. In the previous example, only rows in which the column impnet is positive are allowed to be updated.

When a condition doesn't fulfill the RowCondition, then the delete or edit icon appears greyed out and cannot be cliked.

6 Configuring the from


This section is incomplete and will be concluded as soon as possible.

7 Applying constraints to the form

It is possible the assign constraints to the form values. There are two types of constraints:

Is used to set a default value to a row. This value is going to be inserted in the selected column each time a transaction is done, no matter if Insert or Update
The column is not going to be able to be edited when doing an Update, and the column is going to be inserted as null when doing an Insert


This section is incomplete and will be concluded as soon as possible.