This chapter contains some fairly advanced subject matter. However, even if you don't know what a query is and don't intend to ever create one, you will still interact with default queries created for you by Alventis, so don't get too intimidated.

 

Alventis supports queries using a broad subset of the ANSI SQL-92 specification. Queries can be written by you and executed against the data tables of the Database the queries belong to. A large number of query types is supported, such as the following:

SELECT
UPDATE
INSERT

and many more. Select queries are considered to be in one category of queries since they do not modify any data and produce a set of record as "output". All other types of queries are considered to be in the "Non-Select" category.

 

Alventis also supports Reports as a means of arranging selected records and formatting their contents for printing or some other form of output. Every Report is based on the output of a Select query. Non-Select queries don't produce any output, and so cannot be a source of a Report.

 

You may not know (or ever want to know) how to write Queries, but you will in all likelihood want to produce Reports. This is why Alventis makes your life easier by supplying a Default query for each and every data table. The Default query is nothing more than a rather simple SELECT query mainly based on the data table it "represents". The only twist to it is that the Default queries look-up the Username of the Author of each record. For now though, all you need to know is that for every table you may have, there is at least one Default query based on it, that allows you to base a Report on it.

 

There may be any number of queries. In the simplest case, a query may be based on a single table, the simplest possible such query being SELECT * FROM Contacts, for example. A query may use more than one table as its source though, so in general, it makes little or no sense thinking of a query being somehow "attached" to some specific table. Which is why what you have in Alventis is simply a "flat" list of queries. There is one such list per Database.

 

There may also be any number of Reports. Each Report is based on one and only one Select query, so in this case it does make sense to say: you can have one or more Reports per query. You can also have a query with no Reports based on it, of course.

 

BarIfxQueriesAndReports The Queries List form is then quite simple. It lists all queries of the Database, and under each query that has Reports based on it the Reports. You end up with a two-level grid, where queries occupy the top level, and Reports the second level "under" their queries.

 

QueryList1

 

You can create and delete queries and Reports directly in the grid as you would do with any grid records. There are just a few restrictions on what you can do:

You cannot delete a Default query

You cannot delete a query that has Reports based on it

You cannot create a Report based on a Non-Select query

 

All columns in both the queries and the Reports grids are self-explanatory. The only values you can modify directly in the grids are the 3 last values for the Reports: Name, Caption, and Comment. To modify everything else, you must open the query or the Report in its own form. Double-click the corresponding record to do so. This will open the query in the Query form and the Report in the Report form.