Chart examples
The following table lists sample SQL (MSSQL) and resulting charts.

Select Min(LEFT(Datename(Month,ORD.DATINGAVE), 3)+Str(Year(ORD .DATINGAVE),5)) As XAxis
, Min(LEFT(Datename(Month,ORD.DATINGAVE), 3)+Str(Year(ORD .DATINGAVE),5)) As XAxisCode
, objalg.naam As XAxisSub
, objalg.syscode As XAxisSubCode
, Count(ord.syscode) AS YAxis
From ORD
, PLN_BODEFINITION
, OBJALG
Where ord.fk_bodefinition_userdefined = pln_bodefinition.syscode
And ord.sysobjalg = objalg.syscode
And PLN_BODEFINITION.PNNAME = 'UsrRequest'
And (([&SEARCHFIELDS]) and ([&FILTERFIELDS]))
And Year(ORD.DATINGAVE) = 2014
Group by Year(ord.datingave)
, Month(ord.datingave)
, objalg.naam
, objalg.syscode
Order by Year(ord.datingave)
, Month(ord.datingave)
, objalg.naam
, objalg.syscode

SELECT
(100 * SUM(CASE WHEN ord.statdat5 is not null and ord.statdat5 <= ord.datgewger THEN 1
WHEN ord.statdat5 is null and ord.statdat6 <= ord.datgewger THEN 1
ELSE 0 END)
/
COUNT (ord.syscode)) as GaugeValue
FROM
ord
, pln_bodefinition
, pln_bostate
WHERE
(ord.fk_bodefinition_userdefined = pln_bodefinition.syscode)
AND (ord.fk_bostate = pln_bostate.syscode)
AND (pln_bodefinition.pnname = 'UsrInternal Work Order')
AND (pln_bostate.pnname <> 'Cancelled')
AND (ord.datgewger IS NOT NULL)
AND ((ord.statdat5 IS NOT NULL) OR (ord.statdat6 IS NOT
NULL))
AND (([&SEARCHFIELDS]) and ([&FILTERFIELDS]))
A gauge chart query is a number that is called GaugeValue.

select
PLN_LANGBODEFINITION.TRANSLATIONTEXT XAxis,
count(ORD_NOARCHIVE.SYSCODE) YAxis
from ORD_NOARCHIVE, PLN_BODEFINITION, PLN_LANGBODEFINITION, PLN_LANGP5DEFINITION
where ORD_NOARCHIVE.FK_BODEFINITION_USERDEFINED = PLN_BODEFINITION.SYSCODE
and PLN_LANGBODEFINITION.FK_LANGP5DEFINITION = PLN_LANGP5DEFINITION.SYSCODE
and PLN_LANGP5DEFINITION.LANGUAGE_CODE = 'ENG'
and (([&SEARCHFIELDS]) and ([&FILTERFIELDS]))
group by PLN_LANGBODEFINITION.TRANSLATIONTEXT

SELECT monthtable.MONTHNAME_ENGLISH + ' ' + convert(VARCHAR, monthtable.YEAR) XAxis
,monthtable.SLA XAxisSub
,count(data.value) YAxis
FROM (
SELECT MONTH
,MONTHNAME_ENGLISH
,YEAR
,SLA.SLA_result SLA
FROM PLN_FNDATE
INNER JOIN (
SELECT CASE
WHEN ORD.DATGEWGER > ORD.STATDAT5
THEN '1. Within SLA'
WHEN ORD.STATDAT5 > ORD.DATGEWGER
AND DATEDIFF(d, ORD.DATGEWGER, ORD.STATDAT5) <= 1
THEN '2. Exceeded by 0-1 days'
WHEN ORD.STATDAT5 > ORD.DATGEWGER
AND DATEDIFF(d, ORD.DATGEWGER, ORD.STATDAT5) BETWEEN 1
AND 3
THEN '3. Exceeded by 1-3 days'
WHEN ORD.STATDAT5 > ORD.DATGEWGER
AND DATEDIFF(d, ORD.DATGEWGER, ORD.STATDAT5) > 3
THEN '4. Exceeded by > 3 days'
END SLA_result
FROM ORD
WHERE ORD.DATGEWGER IS NOT NULL
AND ORD.STATDAT5 IS NOT NULL
) SLA
ON YEAR = year(getdate()) - 0
group by MONTHNAME_ENGLISH
,MONTH,YEAR,SLA.SLA_result
) monthtable
left outer join (
SELECT month(ORD.DATGEWGER) month
,year(ORD.DATGEWGER) year
,ORD.SYSCODE value
,CASE
WHEN ORD.DATGEWGER > ORD.STATDAT5
THEN '1. Within SLA'
WHEN ORD.STATDAT5 > ORD.DATGEWGER
AND DATEDIFF(d, ORD.DATGEWGER, ORD.STATDAT5) <= 1
THEN '2. Exceeded by 0-1 days'
WHEN ORD.STATDAT5 > ORD.DATGEWGER
AND DATEDIFF(d, ORD.DATGEWGER, ORD.STATDAT5) BETWEEN 1
AND 3
THEN '3. Exceeded by 1-3 days'
WHEN ORD.STATDAT5 > ORD.DATGEWGER
AND DATEDIFF(d, ORD.DATGEWGER, ORD.STATDAT5) > 3
THEN '4. Exceeded by > 3 days'
END SLA_result
FROM ORD
WHERE
ORD.DATGEWGER IS NOT NULL
AND ORD.STATDAT5 IS NOT NULL
AND (([&SEARCHFIELDS]) AND ([&FILTERFIELDS]))
) data ON monthtable.SLA = data.SLA_result
AND monthtable.YEAR = data.year
and monthtable.MONTH = data.month
WHERE monthtable.SLA IS NOT NULL
GROUP BY monthtable.MONTHNAME_ENGLISH + ' ' + convert(VARCHAR, monthtable.YEAR),
monthtable.MONTH, monthtable.SLA, data.SLA_result
ORDER BY monthtable.MONTH,
monthtable.SLA ASC

Select
replace(Min(
STR(CASE WHEN STR(LEN(DAY(ORD_NOARCHIVE.DATINGAVE))) = 1 THEN replace('0'+STR(DAY(ORD_NOARCHIVE.DATINGAVE)), ' ', '' )
ELSE DAY(ORD_NOARCHIVE.DATINGAVE) END) +'-'+
STR(CASE WHEN STR(LEN(Month(ORD_NOARCHIVE.DATINGAVE))) = 1 THEN replace('0'+STR(Month(ORD_NOARCHIVE.DATINGAVE)), ' ', '' )
ELSE Month(ORD_NOARCHIVE.DATINGAVE) END) +'-'+
STR(YEAR(ORD_NOARCHIVE.DATINGAVE),4)), ' ', '' ) As XAxis,
Count(ORD_NOARCHIVE.SYSCODE) As YAxis
From
ORD_NOARCHIVE
Inner Join PLN_BODEFINITION On PLN_BODEFINITION.SYSCODE = ORD_NOARCHIVE.FK_BODEFINITION_USERDEFINED
Inner Join PLN_BOSTATE On PLN_BOSTATE.SYSCODE = ORD_NOARCHIVE.REF_BOSTATE_USERDEFINED
Inner Join PLN_BOSTATE PARENTSTATE On PARENTSTATE.SYSCODE = PLN_BOSTATE.FK_BOSTATE_SYSTEMPARENT
Where
PLN_BODEFINITION.PNNAME = 'UsrProblem'
And PARENTSTATE.PNNAME <> 'Completed'
And PARENTSTATE.PNNAME <> 'Cancelled'
And (([&SEARCHFIELDS]) and ([&FILTERFIELDS]))
Group By
Year(ORD_NOARCHIVE.DATINGAVE), Month(ORD_NOARCHIVE.DATINGAVE), Day(ORD_NOARCHIVE.DATINGAVE)
Order By
Year(ORD_NOARCHIVE.DATINGAVE), Month(ORD_NOARCHIVE.DATINGAVE),
Day(ORD_NOARCHIVE.DATINGAVE)

When clicking a column, the following list appears

Additional SQL WHERE clause in the Publisher list sub-list
and exists (
select AAA.SYSCODE
from PLN_BODEFINITION AAA
where AAA.SYSCODE = MAIN_TABLE.FK_BODEFINITION_USERDEFINED
and AAA.PNNAME = 'UsrProblem' )
and exists (
select BBB.SYSCODE
from PLN_BOSTATE BBB, PLN_BOSTATE CCC
where BBB.SYSCODE = MAIN_TABLE.REF_BOSTATE_USERDEFINED
and BBB.FK_BOSTATE_SYSTEMPARENT = CCC.SYSCODE
and CCC.PNNAME <> 'Completed'
and CCC.PNNAME <> 'Cancelled' )
and (
MAIN_TABLE.STANDAARD = 'F' And
MAIN_TABLE.DELETED = 'F' And
MAIN_TABLE.ARCHIEF = 'F' And
MAIN_TABLE.REF_BODEFINITION = 296)
And Cast(MAIN_TABLE.DATINGAVE as DATE) = Convert(Date,[&CLICKVALUE],105)