Create a calculated SQL field
Create a calculated SQL field
Technologies > User Interface Add-Ins > Parts for Reports > Report with a Calculated Field
Technologies > User Interface Add-Ins > Parts for Reports > Report with a Calculated Field as Link
If the report combines regular and calculated fields, you can use individual calculated SQL fields instead of using a complete SQL query:
<dataSource id="employeeDS">
<table name="em"/>
<!-- regular fields (will be displayed) -->
<field table="em" name="em_id"/>
<field table="em" name="phone"/>
<!-- calculated SQL fields (will also be displayed) -->
<field table="em" name="location" dataType="text">
<title>Location</title>
<sql dialect=generic">bl_id${sql.concat}'-'${sql.concat}fl_id${sql.concat}'-'${sql.concat}rm_id</sql>
</field>
</dataSource>
You can use both
${sql}
expressions and multiple
<sql>
queries in calculated SQL fields, just as you would in the full SQL query.
A calculated field used in a grid panel may also be set up as a link:
<panel type="grid" ...>
<field name="location" dataType="text" controlType="link">
<title>Building, Floor, Room</title>
<command type="callFunction" functionName="View.alert('You clicked on a custom SQL field');"/>
</field>