This is a migrated thread and some comments may be shown as answers.

Conditional formatting to hide group footer when sum is zero?

7 Answers 644 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ross Presser
Top achievements
Rank 1
Ross Presser asked on 02 Feb 2009, 08:26 PM
I want to hide the group footer when the sum of a particular expression is zero -- not just a single field; it's the product of one field with the sum of three others, and I want to sum this product for all group records and check if it is zero. Can I do this with conditional formatting? I have tried various expressions but whenever it is anything except a single field, the footer section shows as a red box in preview.

This is what I really want:
=Sum(Fields.field1 * (Fields.field2 + Fields.field3 + Fields.field4))
=
0

7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 04 Feb 2009, 05:10 PM
Hi Ross,

Every report section has Conditional Formatting, so basically you can construct one that would match your criteria. From the style builder uncheck the Visible checkbox for when the condition is true.

Greetings,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ross Presser
Top achievements
Rank 1
answered on 04 Feb 2009, 06:18 PM
I understand the style builder part, it seems that I'm not getting the expression right.  See these screenshots:
snapshot showing my conditional formatting expression and style

snapshot showing the red error boxes in preview

If the expression I use is a single field, there's no problem.  It's when I use the sum expression that I get the red boxes.  Help?


0
Steve
Telerik team
answered on 05 Feb 2009, 12:46 PM
Hello Ross Presser,

The red rectangle is actually an exception. It is not visible in Image Preview due to a bug that we have addressed in the latest version Q3 SP2. You can either upgrade to see what the error states or use HTML preview where the error should be visible.

Regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ross Presser
Top achievements
Rank 1
answered on 05 Feb 2009, 04:49 PM
OK, HTML Preview showed me the exception that the red box contains:

An error has occured while processing GroupSection 'GroupFooterSection1':
The relation is not parented to the table to which this DataView points.

What does this mean? My data source consists of a single table and all the fields referenced in the conditional formatting expression are members of that table. Here's my condition, which is the same as it was in the snapshot above:

=Sum(Fields.orderHandling + Fields.orderShipping + Fields.orderTaxes)
= (equals)
=0

OK, I just tried this with the Sum() function removed, and the exception went away! That makes no sense. I need to test against the sum of the expression over all the rows in the group, not against a single row.  So there needs to be an aggregate function.


0
Steve
Telerik team
answered on 10 Feb 2009, 06:16 PM
Hi Ross,

We were able to reproduce the problem and would need some more time to investigate what is going on. We would post back here once we have more info on the matter.

Please excuse us for the temporary inconvenience.

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tim
Top achievements
Rank 1
answered on 02 Jul 2013, 10:28 AM
Version: 2013.2

I am trying a similar thing in a report.  I want the Grouping to be hidden when it's value is Null/Blank.  I have tried numerous expressions but none of them work.  If we assume I am unchecking the "Visible" property in the Style, these are the expressions I've tried:

  • = Fields.SubCategory = <Blank>
  • = Trim(IsNull(Fields.SubCategory, "")) = ""
  • Trim(IsNull(Fields.SubCategory, "")) = "" (notice no "=" in front of expression)

None of the above expressions work in hiding the Grouping even though on the Report the data is NULL for specific SubCategories.

0
Tim
Top achievements
Rank 1
answered on 02 Jul 2013, 10:48 AM
Never mind, I figured out my scenario.  It cannot be done using Conditional Formatting because I want to hide the whole Group Section.  Setting the "Visible" state in the Style of the Conditional Formatting does nothing because you're telling the "Style" to be invisible if a certain condition is met.

I got this to work by using Bindings:
Binding: Visible (property) = Trim(IsNull(Fields.SubCategory, "")) <> ""
Tags
General Discussions
Asked by
Ross Presser
Top achievements
Rank 1
Answers by
Steve
Telerik team
Ross Presser
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Share this question
or