Page 1 of 1

Using conditional aggregate functions in Filter expression

Posted: Thu Dec 03, 2009 11:37 am
by dghani
I am trying to filter a data band based on the number of items in a child band that meet some criterion, and have tried a filter expression like:

CountIf(DataBand, DataSource.Column, DataSource.Column=="ciriterion") > 0

However, I get a message saying that "CountIf" does not exist. Any suggestions as to whether this is possible to do, and if so, what am I doing wrong?

If it is not possible, how could this sort of filtering be achieved?

Using conditional aggregate functions in Filter expression

Posted: Thu Dec 03, 2009 1:57 pm
by Edward
Hi

Please change the expression as follows:

Totals.Sum(DataBand1,DataSource.Column=="ciriterion"?1:0)>0

Thank you.

Using conditional aggregate functions in Filter expression

Posted: Thu Dec 03, 2009 5:33 pm
by dghani
Hi Edward,

Thanks for the quick response. Your suggestion sounds reasonable, and it compiles ok, but still doesn't work as a filter - it appears to return 0 even when items meeting the criterion are present. When I put the same expression (minus the "Totals." and the ">0") in a Text box in the databand I am trying to filter, the correct result is shown.

Is there something very different about the environment in which the expression is evaluated in the filter as opposed to a text component?

Using conditional aggregate functions in Filter expression

Posted: Mon Dec 07, 2009 6:52 am
by Edward
Hi

Please try to use the following expression instead:

Totals.Sum(DataSource,DataSource.Column=="ciriterion"?1:0)>0

Thank you.

Using conditional aggregate functions in Filter expression

Posted: Mon Dec 07, 2009 8:13 am
by dghani
Hi Edward,

Using the data source instead of the databand in the filter expression gives the total of all records in the data source that meet the criterion regardless of the relation : I need the total of only the records related to each master record in order to filter it.

My real problem is actually more complex - I am trying to filter based on a comparison between the counts using two different criteria, hence I was trying to use CountIf in the sort expression in the master band.

Have you any other suggestions for working around this?

Thanks

Using conditional aggregate functions in Filter expression

Posted: Mon Dec 07, 2009 10:32 am
by Edward
Hi

Please send your report and data for it to support[at]stimulsoft.com for analysis.

Thank you.