Aggregation Query Builder: Syntax error?

Dear all,

i´m aggregating cases by diagnosis and gender. The query condition looks like this:

*[CP:gender]=‘M’ AND ( [DE:2528.2529.2524]=‘210 - Dengue’ OR [DE:2528.2529.2524]=‘220 - Dengue grave’ )

···

*[CP:gender]=‘F’ AND ( [DE:2528.2529.2524]=‘210 - Dengue’ OR [DE:2528.2529.2524]=‘220 - Dengue grave’ ) *

When I check the results, I get more cases that what I really have in the DB. I´ve seen, in this example, “Dengue Grave” cases are counted twice, one in M cases and one in F cases, while “Dengue” cases are working fine.

The only way that result makes sense is thinking that the bracket is not being taken into account and the condition is being executed like this *[CP:gender]=‘F’ AND [DE:2528.2529.2524]=‘210 - Dengue’ OR [DE:2528.2529.2524]=‘220 - Dengue grave’ *

After swapping the "Dengue"and “Dengue Grave” position inside the bracket, result changes, getting duplicated the "Dengue"cases now, which supports the idea of the bracket not setting priorities over the logic operators.

Is this possible??? It would explain a lot of weird numbers I´m getting while aggregating :slight_smile:

Thanks!

Dear Marta,

Please modify the formulas as follows:

( [CP:gender]=‘M’ AND [DE:2528.2529.2524]=‘210 - Dengue’ ) OR (**[CP:gender]=‘M’ AND *[DE:2528.2529.2524]=‘220 - Dengue grave’ ) *

*( [CP:gender]=‘F’ AND ( [DE:2528.2529.2524]=‘210 - Dengue’ ) OR ( **[CP:gender]=‘F’ AND *[DE:2528.2529.2524]=‘220 - Dengue grave’ )

Best regards,

···

Châu Thu Trân
HISP Viet Nam
Email: tran.hispvietnam@gmail.com

On Fri, Dec 21, 2012 at 5:47 PM, Marta Vila martavila@gmail.com wrote:

*[CP:gender]=‘M’ AND ( [DE:2528.2529.2524]=‘210 - Dengue’ OR [DE:2528.2529.2524]=‘220 - Dengue grave’ )
*

*[CP:gender]=‘F’ AND ( [DE:2528.2529.2524]=‘210 - Dengue’ OR [DE:2528.2529.2524]=‘220 - Dengue grave’ ) *

Thanks Trân!

it is working fine now.

···

On 21 December 2012 12:54, Tran Chau <tran.hispvietnam@gmail.com> wrote:

*( [CP:gender]='F' AND ( [DE:2528.2529.2524]='210 - Dengue' ) OR ( **[CP:gender]='F'
AND **[DE:2528.2529.2524]='220 - Dengue grave' )*