BackPrevious Page Next PageNext

Creating Computed Columns in a Query

Computed columns can be created in a query that is built on tables, views, and synonyms from one JDBC connection only.

To create a computed column in a query:

  1. In the Query Editor, click New Computed Column on the toolbar or click Menu > Column > New Computed Column. The New Computed Column dialog appears.

    New Computed Column dialog

  2. Input a name for the column in the Computed Column Name text box.
  3. Compose your functions for the column.

    In the lower part of the dialog, there are functions and tables/columns of the query. These are just for your reference. You can specify the expression by yourself in the editing text box, only if the expression can be accepted by your database.

    In addition, the functions in this dialog are not from the JReport system. They are from the database you are connected to. If you change your database, some of these functions may no longer exist. For each database, a different set of supported functions will be returned. The following functions will help you with writing an expression.

  4. When done, click the OK button to create the computed column and it will be added to the SQL of the query.

    Suppose you have created a computed column named Net Total in a query and the computation is @UNITPRICE * @QUANTITY * (100 - @DISCOUNT) / 100, when you view the SQL statements of the query, you will see the following SQL statement being inserted into the SQL: @UNITPRICE * @QUANTITY * (100 - @DISCOUNT) / 100 AS "Net Total".

BackPrevious Page Next PageNext