The List EndPoints are used to create tables where information is displayed. This endPoints also offers the possibility to make transactions.

1 Usage of a List EndPoint

The endPoints of type List are not only used to create tables, they can also be used to make transactions with the dbms. This transactions are done with forms.

table Transaction form

2 Examples of List EndPoint

The List endPoints only requires for a title, a path to make them accessible from an URL and a SQL query code to load the data. Other elements may be configurated to make the list more sophisticated and to allow it to make transactions

This page provides a set of different examples of List EndPoints. For this examples different SQL query codes had been used. The SQL queries used can be found below:

Copy

SQL query

<select>
    <columns>
        <cast type="integer"><rowid table='frontend_doch' /></cast> rowid,
        frontend_doch.tercer,
        frontend_doch.cabid, 
        frontend_doch.email, 
        frontend_doch.telef1, 
        frontend_doch.codnac, 
        frontend_doch.codprv, 
        frontend_doch.poblac,
        frontend_doch.codpos, 
        frontend_doch.direcc, 
        frontend_doch.estado, 
        frontend_doch.imptot, 
        frontend_doch.fecha,
        (<select>
            <columns>
                count(*)
            </columns>
            <from table="frontend_docl">
            </from>
            <where>
                frontend_doch.cabid=frontend_docl.cabid
            </where>
        </select>
        ) <alias name="cantidadarticulos"/>
    </columns>
    <from table="frontend_doch">
    </from>
    <where>
        frontend_doch.tercer = ${USER}  AND
        frontend_doch.estado != "O" AND $0
    </where>
    <order>2</order>
</select>
Copy

SQL query

<select>
    <columns>
        frontend_doch.email, frontend_doch.telef1, frontend_doch.codnac, frontend_doch.codprv, frontend_doch.poblac,
        frontend_doch.codpos, frontend_doch.direcc, frontend_doch.estado, frontend_doch.imptot, frontend_doch.fecha
    </columns>
    <from table="frontend_doch"></from>
    <where>
        frontend_doch.tercer = ${user} AND
        frontend_doch.cabid = ? AND
        frontend_doch.estado != "O" AND $0
    </where>
</select>
Copy

SQL query

<select>
    <columns>
        frontend_docl.linid, frontend_docl.codart, frontend_docl.codalm, 
        frontend_docl.precio, frontend_docl.canped,  
        frontend_docl.dtolin, frontend_docl.impnet, frontend_docl.rowid
    </columns>
    <from table="frontend_docl">
        <join table="frontend_doch">
            <on>frontend_doch.tercer = ${USER}</on>
            <on>frontend_doch.cabid = ?</on>
            <on>frontend_doch.cabid = frontend_docl.cabid</on>
            <on>frontend_doch.estado != "O"</on>
        </join> 
    </from>
    <where>$0</where>
</select>
Copy

SQL query

<select>
    <columns>
        rowid, *
    </columns>
    <from table='frontend_doch'>
    </from>
    <where>
        rowid = ? AND
        tercer = ${USER}
    </where>
</select>

List EndPoints examples:

2.1 Basic Example

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
    </endPoint>
</endPoints>

2.2 List with PDF Example

Note2: To see how to create an object that returns a pdf read the documentation here.

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <pdf column="codart" rowCondition="0 &lt; imptot" conditionSQL="1 = 1">cbal_ce_cos_cuenta</pdf>
    </endPoint>
</endPoints>

2.3 GroupedBy column Example

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <groupBy>poblac</groupBy>
    </endPoint>
</endPoints>

2.4 List with child Example

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" titleSingular="TITLE_ORDER" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <headerSQL>frontend_newOrderHeader</headerSQL>
        <child type="LIST" title="TITLE_LINES" titleSingular="TITLE_LINE" path="orderdetail" fk="cabid">
            <dataSQL>frontend_newOrderLine</dataSQL>
        </child>
    </endPoint>
</endPoints>
Parent Children

2.5 Editable list Example

There are 4 types of available transactions with a list, these transactions must be catalogued in the "Transactions SQL" catalog

  • UPDATE
  • DELETE
  • INSERT
  • EXECUTE

This is the SQL Transaction used for this example:

See below the configuration to define the list EndPoint allowing an update transaction

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" titleSingular="TITLE_ORDER" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <edit>
            <update>
                <dataSQL>frontend_addDoch</dataSQL>
                <dataTRX>frontend_form_doch</dataTRX>
                <condition>'C' != estado</condition>
                <constraints>
                    <default key="estado" value="V"/>
                    <default key="codpos" value="AD500"/>
                    <notEditable key="tercer"/>
                </constraints>
            </update>
        </edit>
    </endPoint>
</endPoints>

This is the original list (note that your dbms may contain a distint set of rows than the ones at the image):

When trying to edit a row (line with rowid 24 in the example), a form will appear to set the new data

At the example the street name has been updated as we can see at the following image:

This is the SQL Transaction used for this example:

See below the configuration to define the list EndPoint allowing a delete transaction

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" titleSingular="TITLE_ORDER" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <edit>
            <delete>
                <dataTRX>frontend_form_doch</dataTRX>
            </delete>
        </edit>
    </endPoint>
</endPoints>

This is the original list (note that your dbms may contain a distint set of rows than the ones at the image):

After deleteing a row, it will be deleted from the dbms and won't appear anymore in the list. At the ecample the line with rowid 23 has been deleted)

This is the SQL Transaction used for this example:

See below the configuration to define the list EndPoint allowing an insert transaction

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" titleSingular="TITLE_ORDER" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <edit>
            <insert>
                <dataSQL>frontend_addDoch</dataSQL>
                <dataTRX>frontend_form_doch</dataTRX>
                <constraints>
                    <default key="estado" value="V"/>
                    <default key="tercer" value="${USER}"/>
                    <default key="fecha" value="${TODAY}"/>
                </constraints>
            </insert>
        </edit>
    </endPoint>
</endPoints>

This is the original list (note that your dbms may contain a distint set of rows than the ones at the image):

When trying to insert a row a form asking for the data will appear

Fill the data of the row

This is the table after adding one line (the last one)

This is the SQL Transaction used for this example:

See below the configuration to define the list EndPoint allowing an execute transaction

Copy

appConfiguration.xml

<endPoints>
    <endPoint type="LIST" title="TITLE_ORDERS" titleSingular="TITLE_ORDER" path="orders">
        <dataSQL>frontend_newOrder</dataSQL>
        <links>
            <link column="estado" href="/form/orders/{rowid}/test"/>
        </links>
        <edit>
            <executions>
                <execution path="test">
                    <dataSQL>frontend_addDoch</dataSQL>
                    <dataTRX>test_execute</dataTRX>
                    <constraints>
                        <default key="estado" value="V"/>
                        <default key="telef1" value="${USER}"/>
                    </constraints>
                </execution>
            </executions>
        </edit>
    </endPoint>
</endPoints>

Realize that for the executions no button will appear, so the link to give access to the execution form must be implemented with a link in a column of the endPoint type LIST. This links will have always the same structure:

  1. /form
  2. / + path to the actual endPoint (orders)
  3. /${rowid} the rowid allows to the application to know the line clicked by the user
  4. / + execution path

This time the page will look something like that:

Once we are at the execution form we will face a page like the following one. The action that will be applied at submit will be the one from the script of the SQL transaction