SQL Data Source
Description
These are the List Builder's SQL Data Source properties.
Connection string
A named or ad-hoc connection string defining how to connect to the database that contains the table, view, or stored procedure that will be used to populate the List control.
Method of defining SQL query
Defines how the SQL query to the database to fetch information to display in the List will be built.
- Method
- Description
- FieldsFromTable
The List will be based on a single table in the database. Selecting this option exposes additional fields to define the table and fields to fetch, including options to order and filter the data.
- CustomSQLStatement (Custom)
You define the SQL statement to fetch the data to display in the list using the SQL Query builder. Use this option if you want to build a list based on a stored procedure.
Table name
The name of the table to query.
Shown when Method fo defining SQL query is FieldsFromTable.
Field list
The fields to fetch from the table.
Shown when Method fo defining SQL query is FieldsFromTable.
Filter
An optional filter to apply to the data. The filter can reference arguments.
Shown when Method fo defining SQL query is FieldsFromTable.
Order
An optional order to apply to the data.
Shown when Method fo defining SQL query is FieldsFromTable.
Distinct
If checked, only unique records are fetched.
Shown when Method fo defining SQL query is FieldsFromTable.
Record limit
The maximum number of records to fetch from the table. If set to -1, all records are returned.
Shown when Method fo defining SQL query is FieldsFromTable.
SQL statement
The SQL statement to execute. When Method for defining SQL query is FieldsFromTable, SQL statement contains the SQL that Alpha Anywhere will execute to fetch the List data based on the Table name, Field list, Filter, Order, Distinct, and Record limit properties.
When Method for defining SQL query is CustomSQLStatement, SQL statement defines the SQL to execute created using the SQL Query builder. You can access the SQL Query builder by clicking the [...] smart field button for the SQL statement property.
If you edit the SQL statement when the Method for defining SQL query is set to FieldsFromTable, Alpha Anywhere will change Method for defining SQL query to CustomSQLStatement.
Portable SQL
If checked, Alpha Anywhere assumes the SQL statement is Portable SQL. Uncheck to use native SQL syntax to query your database.
Shown when Method for defining SQL query is set to CustomSQLStatement.
SQL statement for field list
An optional SQL query to execute to compute the list of fields for the List control. This option is typically used in the case where the List is based on a stored procedure.
Shown when Portable SQL is unchecked.
Primary key
The field(s) that contain the primary key for the SQL query.
Get count of records in query
If checked, a query will be performed to get a count of the total number of records in the List. The count is performed by executing the SQL Statement twice: once to fetch the list data, again to count the total number of records. The record count is primarily used when the List is paginated. If the List is not paginated, you may want to disable Get count of records in query since all of the records will be downloaded to the application and can be counted using client-side scripting.
Server side beforeQuery event
An Xbasic function to execute before any query has been sent to the database to retrieve the List data.
The Xbasic function that handles this event gets passed the SQL statement that will be executed and the SQL arguments that will be used in he query. The Xbasic code can modify the SQL statement that the query will execute, rather than simply changing argument values.
Server side afterQuery event
This server side event is available for List controls that are populated using a SQL data source. The AfterQuery event fires after the List query has been performed. The typical use case for this event is to compute some Javascript to return to the browser. For example, you might want to compute the total for a column in the List and then update some control on the screen.
Server side date and number formatting
Defines the date format for dates and decimal places for numbers returned from queries executed on the List's data source.