Creating computed columns in a query
To create a computed column in a query, follow the steps below:
- In the Query Editor window, select Create Computed Column from the Column menu. The Create Computed Column dialog will then appear. See the dialog.
- Input a name for the column in the Computed Column Name text box.
- Compose your functions for the column.
- When done, click the OK button to create the computed column.
Notes:
- In the lower part of the Create Computed Column dialog, you can see some 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.
- The functions in this dialog are not from the JReport system. They are from the database you are connected to.
- If you change your data source, 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.
- +: Add numbers or fields together in the Expression menu.
- -: Subtract numbers or fields together in the Expression menu.
- *: Multiply numbers or fields together in the Expression menu.
- /: Divide numbers or fields together in the Expression menu.
- =: Equate fields together.
- ": Place quotations on long character strings or names that have blanks in them (example: place quotes on values such as "New York" or "Washington DC").
- ||: Place fields together in the same Expression menu. (Example: "New York" || "Washington DC").
- (): Place your fields in parentheses.