Grid Data Source Menu

Description

The Grid > Data Source Menuprovides two options that select the type of database connection that will be used: .dbf Tables or an SQL database accessed via AlphaDAO (Alpha Data Access Objects). Selecting one or the other will open either the Grid > Query(DBF) menu or the Grid > Query(AlphaDAO) menu.

 Grid Query (DBF) Menu

This menu defines the grid's data source. Depending on what you select from the ' Display data from' option this source data will be derived from either an Alpha Anywhere table or a view. Choosing Table will specify that the grid will come from a single table name and table alias fields. The table to be used is entered in the ' Table name ' textbox. Simply click on the dropdown to the right of the textbox and select one of the existing Alpha Anywhere tables saved in your workspace. The 'Table alias', or the name used by Alpha Anywhere to refer to the table internally, is filled in automatically when you select a table name. The ' Calculated fields ' option lets you input new fields into your grid based on existing data in your grid. This is only really possible in the Grid Builder for work with read-only files. If you click on 'Calculated fields', the Calculated Values Dialog will open. To create new fields from existing ones simply type in the name of the new field and specify which existing fields will supply data to the new one. The Calculated Values dialog has drop down lists of functions and existing fields to make this task simple. It also contains a number of additional tools as well as connections to the Expression builder dialog, Fields dialog, and the Function Finder.

A new fullnamefield being generated from first and last names.

The Calculate Values Dialog has additional tools

The Define Arguments button in the Table query loads the Define Arguments dialog which lets you specify arguments to be used in filter and order expressions. The Filter option lets you filter existing records for records containing certain characteristics. To create a filter click the to the right of the 'Filter' textbox.

This will load the Expression Builder . If you want help creating a filter in the Expression Builder just click on the Filter Genie button to load the Filter Builder dialog. This will make it easy to choose which fields you want to filter and how you want to filter them. Creating a filter for all first names containing 's':

The Order option in the Table query lets you choose which field you will use to order you records by. If you want, you can actually order your grid using multiple fields, first sorting by one field, then another, and another. To do this, click the button to the right of the Order option. This will open an Order Builder dialog that has dropdowns for all of your fields and an A...Z or Z...A sort option. Below the Order option, Sort Direction lets you decide whether the records are sorted in an ascending or descending direction. The Define Primary Key(s) button at the bottom of the table query lets you define whether to use record number or an expression for the tables primary key. Using an expression here is recommended, as a record's record number can change after a table is packed.

See also Define a Table Query

Alpha Anywhere Table Query

 Table Query Options

  •  Display data from: Table

    Specifies that the grid will come from a single table. Displays the Table name and Table alias fields.

  •  Display data from: View

    Specifies that the grid will contain fields from 2 or more tables. Displays the Tables in Viewand Fields in Viewbuttons.

  •  Table name

    Displays a list of tables in the current database.

  •  Refresh

    Refreshes the contents of the Table namelist.

  •  Table alias

    This is the name that is used internally to refer to the table.

  •  Tables in View

  •  Fields in View

    Displays the Select Fields in Viewdialog, where you select the fields to display and define calculated fields.

If you choose Display data from: View rather than table, you will specify that the grid will come from a view that contains fields from 2 or more tables. It will also change the options on the Grid Query (DBF) Menu by displaying the Tables in View and Fields in View buttons. The other options that you saw in the 'Display data from: Table' explanation above will remain the same. Clicking the Tables in View: button will load the Add Table dialog which will ask you to select a table to use from a list. Unless you specify otherwise the Add Table dialog will also add an alias to the selected table. Click OK and the Define Join dialog will load. Add another table or simply click OK again and the table will be added to 'Tables in View'. If click the Tables in View button after adding a table you will be taken directly to the Define Join dialog. If you add a second table to Define Join you will be asked to define the link properties between the new and existing tables.

Clicking the Fields in View button will load the Select Fields in View Dialog. Here you can create a list of fields and calculated field definitions. The fields that you see in Fields in View will be the fields contained in the tables you selected using Tables in View. The Select Fields in View dialog allows you to select the fields from a table that you want to work with in your View. To add an individual field, simply highlight it using the list of the left and then click the single arrow button > to bring it into the view. To move all the fields in your tables into the view select a field in the list and click the double arrows >> to bring them into the view. Similarly, select a field in the view list on the right and click the single < or double << arrows pointing the opposite direction to remove one or all of the fields from the view. Once a field is in the view, you can place an = sign after the field to gain access to the Expression Builder. The Expression Builder button will appear at the bottom of the dialog as soon as you do this.

See also Define a View Query. Expression Builder.

Alpha Anywhere View Query

 View Query Options

  •  Arguments

    Displays the Define Arguments dialog, where you specify arguments to be used in filter and order expressions.

  •  Filter

    Specifies the expression that selects the records that will be included in the grid.

  •  Order

    Specifies the expression that orders selected records.

  •  Sort Direction

    Specifies whether the order of records will be ascending or descending.

  •  Unique records only

    Specifies that the grid will display unique records only.

  •  Read only

    Specifies that the grid's fields will be displayed in label controls.

  •  Define Primary Key(s)

    Specifies the field(s) that uniquely identify each record.

The Grid > Query(AlphaDAO) menu defines the grid's data source, which is a SQL SELECT statement directed to a SQL back-end database. SQL or Structured Query Language is used to manage data within many databases. To access and manipulate this data you will need to first establish a connection string. Fortunately, Alpha Anywhere makes this as easy as selecting the file to connect to. When you first open the Grid > Query(AlphaDAO) menu it will ask you for a Connection Type: at the top of the screen. If you don't want to give your connection a name select Specify Connection String from the Connection Type dropdown and click the Build button. This will load the Create SQL Connection String Dialog . At the top of the Create SQL Connection String Dialog you will notice another Connection Type dropdown. Here you can choose the database software that contains the data which you want to access and where you will ultimately store your data. Most of these Connection Types will prompt you to select the File Name: you wish to connect to under the Options menu. Click OK and the connection string should appear on the Grid > Query(AlphaDAO) page. The Create SQL Connection String Dialog

If you are creating a lot of connection strings and storing data in different databases you might want to give your connection strings a name for ease of use. On the Grid > Query(AlphaDAO) page go to the Connection Type: option and select Use Named Connection String . Next click Add/Edit Saved Connections to add a new named string. This will load the AlphaDAO Connections dialog box. Click New , this will load the New AlphaDAO Connection dialog. Enter the Connection Name: of your new connection in the textbox at the top of the dialog. Then place the connection string path in textbox entitled ' Connection String: '. If you do not know the path you can click Build, which will bring you back to the Create SQL Connection String Dialog and help you create a new path. Creating a New Connection Name

Once a connection string name is defined you can connect to it by going to the Grid > Query(AlphaDAO) page and clicking the Select... button next to the Connection Name textbox. This will open the AlphaDAO Connection Strings dialog and will show you a list of all your named connections. Select the connection you want to use and click OK . Your connection will now appear on the Grid > Query(AlphaDAO) page. Click Connect to connect to it.

Also see Create SQL Connection String Dialog.

Connecting with a SQL Database Using a Named Connection String

Connecting with a SQL Database By Building a Connection String

 Building a Connection String Options

  •  Connection type

    Specifies the type of connection to the database.

    • "Use Named Connection String" - allows you to select from the Connection Namelist

    • "Specify Connection String" - click the Zoomor Buildbuttons to define a connection string.

  •  Build

    Displays the Create SQL Connection String dialog, where you can create a connection string.

  •  Zoom

    Displays the Edit Connection Stringdialog, where you can enter a connection string.

  •  Connection Name

    Specifies the saved connection that you will use to connect to the database.

  •  Add/Edit Saved Connections

    Displays the Connectionsdialog, where you can select, create, or edit a connection string.

AlphaDAO Table Query

AlphaDAO SQL Query

Stored Procedure Query

 Key Functions

  •  Base on: Table or View

    Displays the Table/View name, Table/View alias, Filter, and Order byfields.

  •  Base on: SQL Select Statement

    Displays the Edit SQLbutton, SQL Select Statementwindow, and Select Primary Key(s)button.

  •  Table/View name

    Displays a list of tables in the current database.

  •  Refresh

    Refreshes the contents of the Table/View namelist.

  •  Table/View alias

    This is the name that is used internally to refer to the table.

  •  Arguments

    Displays the Define Arguments dialog, where you specifies arguments to be used in filter and order expressions.

  •  Filter

    Specifies the expression that selects the records that will be included in the grid.

  •  Order by

    Specifies the expression that orders selected records.

  •  Read only

    Specifies that the grid's fields will be displayed in label controls.

  •  Edit SQL

    Displays the SQL Builderdialog, where you can define a SQL SELECT statement.

  •  Select

    Specifies the field(s) that uniquely identify each record.