connectivity tool provides tools for graphical constructing SQL query to AnyLogic
Database. Query is the general SQL operation of retrieving data from database tables.
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:
Agent population. Each row of the query result will be used to add one more agent into a population.
Values will be used to setup the parameters of the agent. This option is very useful in
agent based modeling
when you want to populate your model with
agents, who have characteristics defined by parameters stored in some database.
Each row of the query result will be used to add one more element to a collection. Values will be stored in the fields of the collection variable.
Creating a query
To define a query
- Drag the
element from the
section of the
palette to the graphical editor.
- Open the
view and modify the
of the element. This name will be used to identify and access this query.
- In the
edit box, specify the database this query will access.
- 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
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.:
- Otherwise, if you need to retrieve some specific data only, select the
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
Using the preview, you check the query. Table fields should match the ones defined in the query.
- Select the
object you want to examine.
- Go to the
- You will see the table listing the result this query will return. The table contains columns you have specified in the query.