Home    Download    Screenshot    Quick Start    Documentation    History

Oxetta Database Reports Parameters

When using Oxetta to print reports from the database, you can use two types of parameters in your SQL queries: SQL parameters and Oxetta parameters.

SQL Parameters

Each Oxetta report band in the database-enabled report might have an SQL query assigned to that band. When printing the report, Oxetta launches this query during the very first attempt to print the band and get information that should be printed in the band elements, e.g. DB Text Boxes.

This query might have SQL parameters in it, e.g. the "SELECT name FROM employee WHERE department_id=:dep_id" query has the ":dep_id" parameter in the query. We can also write the same query in a slightly different manner: "SELECT name FROM employee WHERE department_id=?". In the first query we use a named parameter dep_id, but not many databases do support named query parameters. In the second query we use an unnamed parameter "?", and unnamed SQL parameters are supported in most databases.

When launching SQL queries with parameters, Oxetta checks the Parent Data Source report band for parameter values. If the Parent Data Source band has an SQL query assigned, Oxetta gets parameter values from the recordset associated with that Parent Data Source report band. If you are using named SQL parameters (e.g. ":dep_id"), it looks for column named "dep_id" in that recordset, and retrieves the value for that parameter from that column. If you are using unnamed parameters (e.g. "?"), Oxetta gets the value for the first parameter from the first column of the Parent Data Source recordset, the value for the second parameter from the second column of the Parent Data Source recordset, etc.

Oxetta Parameters

You might also need Oxetta to gather the values for parameters not from another recordset within the same report, but from your C/C++ application. This can happen, for example, in the case when you print a sales report and need the user to specify reporting period. In this case you might request the user to specify reporting perion in your C/C++ application and then pass entered parameters into Oxetta to print the report.

To do so, you specify the following query in Oxetta report: "SELECT * FROM sales WHERE sales_date>={PARAM_SALES_DATE}". When Oxetta prints this report, it recognizes the PARAM_SALES_DATE Oxetta parameter in this query by it's brackets and requests this parameter value from the calling application with the help of the callback function. After receiving parameter value from the calling application, Oxetta replaces the {PARAM_SALES_DATE} string in the SQL query text with the value received from the application, and launches the query.

Conclusion

In other words, Oxetta parameters are very different from SQL parameters. SQL parameters are SQL things with special processing and optimization issues; Oxetta parameters are a simple substitution of part of SQL query text with a different text immediatelly before SQL query execution. However, Oxetta parameters give you a good way to transfer information from your application to the report and gracefully change your queries "on the fly".

First article: Designing A Report And Launching It From Your Application
Oxetta documentation: Documentation Index

 Copyright © Oxetta, 2016