SQL Builder

The SQL Builder is used in a web component to construct a SQL SELECT statement against one or more tables when the data source is Microsoft Access or another ADO/ODBC compatible database.

To open the SQL Builde r:

  1. Display the Web Projects Control Panel.

  2. Open an existing grid component or create a new grid component.

  3. On the Grid > Data Source menu page, select either Remote Database accessed via ADO or Remote Database accessed via AlphaDAO.

  4. After connecting to the database, select Base on SQL Select Expression.

  5. Click Edit SQL. [Picture]

Note : SQL expressions used in web publishing should conform to native ADO database requirements when working with ADO databases and Portable SQL standards when working with non-ADO databases.

To use the SQL Builder :

  1. Click Tables in Query to display the Define Join dialog.

  2. In the Define Join dialog click Add Table to display the Add Table dialog.

    1. In the Add Table dialog select a table or view from the Tables list.

    2. Optionally, enter an Alias for the table or view.

    3. Click OK to continue or Cancel to discard your selection and return to the Define Join dialog box.

  3. For each additional table that you want to include in this SELECT statement, pick the parent table and click Add Table. Repeat steps 2a through 2d.

  4. For each child table visible in the Define Join dialog box, optionally set the following values.

    1. Select a different table from the Table drop-down list.

    2. Specify a different Alias for the table.

Note : A table alias can make your grid portable, by separating it from direct reference to a table name. as long as a table has the same structure and the same alias, it can use a grid originally built for another table. However, if you change an alias after you select the fields to retrieve, you will have to redefine the field selection.

    1. Select a different parent table from the Parent drop-down list.

    2. Make a different selection in the Include Parent list.

    3. Specify a different Link Expression for the child table. Click to display the Select Fields dialog.

    4. Specify a different Parent Link Expression for the parent table. Click to display the Select Fields dialog.

    5. If you want to discard your changes, click Cancel Edits.

    6. If you made any changes you want to keep, click Apply Edits.

    7. Click OK to continue or Cancel to discard your inputs and return to the SQL Builder.

  1. Click Fields in View to display the Select Fields in View dialog.

    1. Select a table from the drop-down list at the top left of the dialog box.

    2. Select the fields that you want to include in the grid and click to put their names into the displayed field list at right.

    3. Optionally, click to add all fields to the grid.

    4. Use and to remove individual or all fields from the displayed field list.

    5. Optionally, compose an expression based on multiple fields.

    6. Use the and buttons to sort the displayed field list.

    7. Optionally, use the , , and buttons to reorganize the sequence of fields.

    8. Click OK to select these fields or Cancel to exit without changes.

  2. Optionally, click at the right side of the Filter field to display the Specify Filter dialog box. This dialog specifies which records will be retrieved (the WHERE clause of the SELECT statement). Refer to Specifying a Filter Expression.

  3. Optionally, click at the right side of the Order field to display the Specify Order dialog box. This dialog specifies the ordering clause(s) of the SELECT statement). Refer to Specifying an Access Order Expression.

  4. Optionally, display the SQL Text tab to see the SQL SELECT statement. You may manually edit this statement, but afterwards it will no longer be editable by the SQL Builder. [Picture]

  1. Click OK to continue or Cancel to discard your inputs and return to the Web Component Builder.

Specifying a Filter Expression

This SQL expression will refer to one or more fields in the table and return a logical value (i.e. True or False).

Note : Clicking Live Preview in the Web Component Builder will return a Syntax error message if your SQL expression is not syntactically correct.

  1. If you want to select all records in the table or view, click Cancel.

  2. You can directly type an SQL expression in the Filter field.

  3. Use the button to select fields from the Available Fields list.

  4. Use the AND, OR, =, and ' buttons to insert these language element into the Filter field.

  5. Click OK to complete the filter expression or Cancel to discard your inputs.

Specifying an Order Expression

This SQL expression will refer to one or more fields in the table. Fields will be separated by commas.

Note : Clicking Live Preview in the Web Component Builder will return a Syntax error message if your SQL expression is not syntactically correct.

  1. If you want to select all records in the table or view, click Cancel.

  2. You can directly type an SQL expression in the Filter field.

  3. Use the button to select fields from the Available Fields list.

  4. Use the AND, OR, =, and ' buttons to insert these language element into the Filter field.

  5. Click OK to complete the filter expression or Cancel to discard your inputs.

  6. If you are in the process of creating a grid, continue with Selecting the Fields to Display.

See Also

Creating a Grid Component, Portable SQL, Supported Portable SQL Syntax

Supported By

Alpha Five Version 6 and Above