Calculated fields allow you to manipulate the information in the database and make it more friendly or getting specific calculations in the source itself without having to do it in the report.
The calculated fields in Advanced Reporting use the DomEL Syntax: Advanced Reporting 101: The DomEL Syntax used by Calculated Fields
Two examples of custom fields you will create the most:
Dates: date fields in CSM are stored as Epoch format. They are an integer field with the number of seconds past 1970-01-01 00:00:00. To make it become a real date you need to create a calculated field with:
To create a calculated field you need to go to the Domain Designer: Advanced Reporting 101: Accessing the Domain Designer
Go to the Calculated Field tab:
Configure the three fields as per your need:
Field Name is the name of your new field. Just keep in mind you can't use spaces and some special characters can be a problem.
Type is the type of your new field. Types are self explanatory.
Expression is the expression you want to use to calculate your new field. Here you can have math expressions, concatenations, use SQL Functions, etc. It is mainly SQL code but there is also the possibility to use DomEL Syntax
When you are building the expression you can type in the tables and fields references or you can double click a field to add it to the expression automatically.
When you save your calculated field:
Let's say you need to create these fields:
Ticket created date in date format
Ticket Requester as Last Name, Name
These are the configurations you need:
You can simply copy and paste the expression above to the Expression field
Once you click Save Field it will be saved in the VAPP_ITEM table because the origin fields are all from there.
Next you just need to make this fields visible using the Display tab: link to be added
If I want the Class Category Type and Item as one field in my report will I use the "concat" as well for this?
Yes Pam. Use Concat.
you can use every function your underlying database (Oracle or MSSQL) supports. On top, please have a look at the domain expression language (The DomEL Syntax | Jaspersoft Community)
I have created a calculated field (Calculated_Open_Date) using EPOCH_TO_UTC_DATETIME function and added that in Display section of the domain (Date Format: None, Summary Calculation: CountAll, Field or measure: Dimension). When I am creating the Add Hoc View using that domain and trying to add the Calculated Open Date field in the Column section, it is showing the error that:
"An error occurred while performing the previous request"
It is showing no parsing error during calculated field creation.
Kindly suggest the solution for this.
Thanks & Regards,
It is showing the following error:
Hi Balram.Deswal please open up a new thread for this discussion so we can investigate this separate from the 101 document.