Aggregation Query Builder doesn't count

Hi=2C We have reviewed in detail and we found that the problem is presented=
with aggregation query that use the attribute of patient that we have crea=
The postgres console print the next error.
ERROR: syntax error at or near ")" at character 617
STATEMENT: SELECT '0' as dataelementid=2C '0' as categoryoptioncomboid=2C o=
u.organisationunitid as sourceid=2C '0' as periodid=2C'DHIS-SYSTEM' as comm=
ent=2C '201308' as periodIsoDate=2C'dataelementname' as dataelementname=2C =
'optioncomboid' as categoryoptioncomboname=2C as organisationunitna=
me=2C count (psi.programinstanceid ) as value FROM programstageinstance as =
psi INNER JOIN organisationunit ou on ou.organisationunitid=3Dpsi.organisat=
ionunitid WHERE EXISTS ( SELECT * FROM patientattributevalue _pav WHERE _pa=
v.patientid =3D pi.patientid and _pav.patientattributeid=3D280 AND p.organi=
sationunitid in (0) AND _pav.value )=3D'Especial' ) GROUP BY ou.organisatio=

the error is generated when we edit the aggregation query=2C but it is don'=
t generated with aggregation query that use the attibutes of patient that i=
t is by default. (Sex).


ING. Helder Yesid Castrillon.
Secretar=EDa departamental de salud