# Set the '''Property Value''' to the desired SQL statement.
#: [[Image:IReport SQLField3.png|center|300px|''Set the SQL Values'']]<div align="center">''Set the SQL Values''</div>
# Return to the report and use the new SQL Field just like any other '''string''' field.{{note|Even if the query returns a numeric value, it is converted into a string; the result of the SQLField is always a string. Therefore, if the return values have to be used as input to some calculation, they need to be explicitly cast to numeric values.}}
====SQL Field Examples====__NOEDITSECTION__
The SQL statement can be any valid SQL PostgreSQL statement that '''returns a result'''. This field can be used Especially when working with charts, null values will lead to retrieve data that errors. Therefore, it is a good practice to use a function like COALESCE() in difficult order to access areas of the databaseensure that null values are replaced by a custom value. You can use any valid PostgreSQL statement in the SQL field including
* VIEWS, JOINS, HAVING, sub-selects, and sub-queries
* PostrgreSQL functions such as COALESCE()
As with other areas in iReport, the ''links.toGuid'' field is case sensitive and must be referenced exactly.
Further information about this can be found on the [[Create i-Report Templates with Subreports|Subreport instruction pages]].
==Sorting and Grouping==__NOEDITSECTION__