Remove

Stimulsoft Reports.NET discussion
Post Reply
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Remove

Post by IskandarAir »

Dear Stimulsoft team,

We are facing an issue - we cant hide group header band when the group have no PROPER value (our custom logic when records have no salary data).
Our custom logic use the following code to hide rows with employees that didn't get payment yet, but records' row exists & comes from db.

Code: Select all

 
            dataBand.Conditions.Add(new StiCondition
            {
                Item = StiFilterItem.Expression,
                Expression = cond, //comment -  smth like - (Data.CP4 == 0 || Data.CP4 == -9999999) && (Data.CP5 == 0 || Data.CP5 == -9999999)
                Enabled = false
            });
We can hide footer by using variable (simple idea when group-header starts we start counting by adding 1 to variable and if at the end of group header variable is 0 - then hide). The code is following:

Code: Select all

            var departmentGroupFooterBand = report.GetComponentByName("DepartmentGroupFooterBand") as StiContainer;
            //removing footer with empty data rows which has empty additional column
            if (departmentGroupFooterBand != null)
            {
                departmentGroupFooterBand.Conditions.Add(new StiCondition
                {
                    Item = StiFilterItem.Expression,
                    Expression = $"{valueRowsVar} == 0",
                    Enabled = false
                });
            }
We tried the same logic with header band, but unfortunetely, it is always 0 at the begining of group (in header after print event). We tried with default counts (count(groupHeaderBand), distinctCount(ColumnName) ), but it does not work, header is being shown.

One thing we noted that if we put a variable text field in header to see the numbers of rows in grouping it works okay (it shows rows in corresponding group). Image attached,

Can you please suggest what we can do about it ?

Your truthful client,
Iskandar A
Attachments
errorInHeader.PNG
errorInHeader.PNG (73.12 KiB) Viewed 2796 times
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Remove

Post by IskandarAir »

Badly need help.
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Remove

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data which reproduces the issue for analysis.

Thank you.
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Remove

Post by IskandarAir »

Hi,

Please check attachments. Please we do need it urgently.

In MsSQL connection, please customize to your own environment. I am using master and SELECT\UNION ALL. which will work on any sql server database

Regards,
Iskandar A
Attachments
HideEmptyHeaders.mrt
sample
(13.48 KiB) Downloaded 115 times
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Remove

Post by Lech Kulikowski »

Hello,

In the sent sample, you can use the same Condition for GroupHeader as for band and footer.

Thank you.
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Remove

Post by IskandarAir »

Hello,

But i tried this obvious approach as i stateed in my first question post. What you say is it true for version 2017.1.6.0 as well?

REgards,
Iskadnar A
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Remove

Post by IskandarAir »

Dear Lech,

Please find attached and update sample mrt file. The same Condition does not work properly at all.
It seems during procession condition in the headerband the variable is zero. Please pay attention to where we do zerofying of variable (it is in GroupHeader band afterPrint event - tried with beforePrint as well).


You may say that Using detail band's condition can do a trick with groupHeader band - but it is the reason we faced client's request since it does not work even as proper as with Variable

Please attach the working solution, i believe you do testing before replying and that can be useful to us.


Waiting for your response,
Iskandar Anvarov
Attachments
HideEmptyHeaders_updated.mrt
(14.87 KiB) Downloaded 117 times
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Remove

Post by IskandarAir »

Here is updated mrt result. which is wrong as you see.
Attachments
Updated.mrt results
Updated.mrt results
errorResult.PNG (126.24 KiB) Viewed 2718 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Remove

Post by HighAley »

Hello.

You could use an additional Data Source from Other Data Source where you can calculate the salary for each group.
Please, look at the attached report template.

Thank you.
Attachments
HideEmptyHeaders_modified.mrt
(11.03 KiB) Downloaded 126 times
Post Reply