jeremy.suiter Posted May 9, 2018 Share Posted May 9, 2018 Hi,I've got a problem where I want to stop a group header from printing bsed on a total calculated for that group. The SQL query returns line items only and I cannot do any pre-totalling and that cannot change.So I have a total calculating for a group and when it's zero I do not want to print that group at all. No problem using the print when expression for the footer but I cannot find a way to stop the group header from printing.I've tried everything using sub datasets and sub reports but I cannot find a way to pre-calculate the total so I can use it or link the header and footer together so when the footer is suppresses so is the header.As I mentioned before I cannot pre-calculate these totals in the SQL query at all.Can anyone help me? Many thanksJeremy Link to comment Share on other sites More sharing options...
riodavid Posted May 10, 2018 Share Posted May 10, 2018 Hi Jeremy,I tried on my side yes it's almost impossible to achieve.But one workaround works for me.1. Set the group header cell height to 1. (It have to be 1, not 0. If it's 0 then it will disappear.)2. Set the group header text expression to IF($F{your_amount} == 0,"",CHAR(13) + $F{Group_Header} + CHAR(13)) CHAR(13) is the space that makes the final display more beautiful.3. Set the group header text "Stretch With Overflow" to true. The mechanism behind, is to display every header as a 1 pixel height cell, which is almost invisble. If there're values, the 1 pixel will be streched, so values can be seen. Hope it helps.BRD Link to comment Share on other sites More sharing options...
jeremy.suiter Posted May 10, 2018 Author Share Posted May 10, 2018 Hi, I'm afraid that won't work as the logic is dependent on a variable total for the group which will always be zero when the group header prints. The print when logic for the group footer is $V{group_total}!=0.00 and when this suppresses the group footer I want the group header to suppress as well.RegardsJeremy Link to comment Share on other sites More sharing options...
riodavid Posted May 11, 2018 Share Posted May 11, 2018 Ah, I understand your concerns. Try set the [Evaluation Time] of the variable text field to [Group], rather than [Now], you will see magic happens. Link to comment Share on other sites More sharing options...
jeremy.suiter Posted May 11, 2018 Author Share Posted May 11, 2018 I appreciate your help but I'm afraid that won't work either as this has nothing to do with a text field. I don't even use the variable on the report it's just a total that I want to use to not print the group header & footer.This is probably just a limitation of the way Jasper works in that the variable is evaulated after the header is printed so what I want to do just isn't possible.Jeremy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now