Query

Query connectivity tool provides tools for graphical constructing SQL query to AnyLogic Database. Query is the general SQL operation of retrieving data from database tables.

Using Query, you can feed up a model with data returned by the specified query. Query result represents a set of rows. Each row contains a set of values from the table's columns you have specified in the query. You can use the query result to construct:

Creating a query

 To define a query

  1. Drag the Query  element from the Professional section of the Connectivity palette to the graphical editor. 
  2. Open the Properties view and modify the Name of the element. This name will be used to identify and access this query. 
  3. In the Database edit box, specify the database this query will access .
  4. If you need to retrieve all data from some table of the specified database, just select the Select all from the table option in the Query section and specify the name of the table in the edit box to the right.
    If you are working with Access 2007 database. specify the name of the table in the square brackets, e.g.: [Table]
  5. Otherwise, if you need to retrieve some specific data only, select the SQL option and type your custom query in the edit box below.

Previewing the query results

You can preview the query result any time. 

 To preview query results

  1. Select the Query object you want to examine.
  2. Go to the Properties view, Data feeding section. 
  3. You will see the table listing the result this query will return. The table contains columns you have specified in the query. 
Using the preview, you check the query. Table fields should match the ones defined in the query.