Custom SQL (Chart)



Specifies an SQL statement to use to retrieve the records for a chart, including maps.

Charts expect labels and values for data points, so the SQL statement must conform to one format to be used by the chart: data returned in the last column of the query is used for values, and each previous column is used for labels. If there are n multiple columns in a result set, then the 1st, 2nd, ..., and nth - 1 columns are concatenated together to form the label. For example, if 3 columns are returned in a result set, then the first and second columns are concatenated and become the labels, and the third column is used for chart data values.

This property can be used with the Order By, and record limit properties to sort and limit query results. The chart may use the chart options property to style the chart or map differently than the default.


Promptable? YES
Possible Values: Any valid SQL statement
Bindable? YES
Products: ProfoundUI, Genie

Examples

SELECT PNAME, PPRICE FROM PUISAMPLES/PRODP

The query above would produce a chart with product names (PNAME) as labels and prices (PPRICE) as values.



SELECT PNAME, PCNAME, PSTOCK FROM PUISAMPLES/PRODP

The query above would produce a chart with produce names concatenated with category names (without spaces between the fields), and stock numbers (PSTOCK) as values.



SELECT PNAME || ' ' || PCNAME, PSTOCK FROM PUISAMPLES/PRODP

The query above concatenates two fields with a space between, resulting in two columns in a result set; so, the query would produce a chart the concatenated fields as the label, and the stock numbers (PSTOCK) are the values.