Conditional formatting to hide group footer when sum is zero?

8 posts, 0 answers
  1. Ross Presser
    Ross Presser avatar
    30 posts
    Member since:
    Dec 2008

    Posted 02 Feb 2009 Link to this post

    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

  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 04 Feb 2009 Link to this post

    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.
  3. DevCraft banner
  4. Ross Presser
    Ross Presser avatar
    30 posts
    Member since:
    Dec 2008

    Posted 04 Feb 2009 Link to this post

    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?


  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 05 Feb 2009 Link to this post

    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.
  6. Ross Presser
    Ross Presser avatar
    30 posts
    Member since:
    Dec 2008

    Posted 05 Feb 2009 Link to this post

    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.


  7. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 10 Feb 2009 Link to this post

    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.
  8. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 02 Jul 2013 Link to this post

    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.

  9. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 02 Jul 2013 Link to this post

    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, "")) <> ""
Back to Top
DevCraft banner