﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<StiSerializer version="1.02" type="Net" application="StiReport">
  <Dictionary Ref="1" type="Dictionary" isKey="true">
    <BusinessObjects isList="true" count="0" />
    <Databases isList="true" count="1">
      <MS_x0020_SQL Ref="2" type="Stimulsoft.Report.Dictionary.StiSqlDatabase" isKey="true">
        <Alias>MS SQL</Alias>
        <ConnectionStringEncrypted>9PL3Ce8Fo/VrHdls+kkl+8Rg+UjdS3vty2e9bGDcJWfKcIEMT3FC3eFE/b1xPaxu4FqVSMYFQoHLE4SETSit+9lWvwlLdaO8eXulCGRwKOfDVmWj5mhShfNEocxOBCITkHDNKMJ9QqRrFf3M5AGgT+Nw20jXTZPFa3z97MNJ9offGM0ISgNa8fdOvYRh+LHb2WqJjMYVY+3hSUWlYtjhN9UU2cPFaw==</ConnectionStringEncrypted>
        <Name>MS SQL</Name>
      </MS_x0020_SQL>
    </Databases>
    <DataSources isList="true" count="1">
      <Data2 Ref="3" type="Stimulsoft.Report.Dictionary.StiSqlSource" isKey="true">
        <Alias>Data2</Alias>
        <Columns isList="true" count="3">
          <value>EmpName,System.String</value>
          <value>Emp_Salary,System.Int32</value>
          <value>Department,System.String</value>
        </Columns>
        <CommandTimeout>30</CommandTimeout>
        <Dictionary isRef="1" />
        <Name>Data2</Name>
        <NameInSource>MS SQL</NameInSource>
        <Parameters isList="true" count="0" />
        <SqlCommand>SELECT 'James Bond' as 'EmpName', 120 as 'Emp_Salary', 'Universal' as 'Department'
UNION ALL  SELECT 'Killer' as 'EmpName', 130 as 'Emp_Salary', 'Universal' as 'Department'

UNION  ALL  SELECT  'Harry P' as 'EmpName', 120 as 'Emp_Salary', '21 Century' as 'Department'
UNION  ALL  SELECT  'Hermeona G' as 'EmpName', 0 as 'Emp_Salary', '21 Century' as 'Department'

UNION  ALL  SELECT  'Ironman' as 'EmpName', 0 as 'Emp_Salary', 'Marvel' as 'Department'
UNION  ALL  SELECT  'Captain A' as 'EmpName', 0 as 'Emp_Salary', 'Marvel' as 'Department'
UNION  ALL  SELECT  'Lazy Developer' as 'EmpName', 0 as 'Emp_Salary', 'Marvel' as 'Department'

UNION  ALL  SELECT  'Big Jam' as 'EmpName', 0 as 'Emp_Salary', 'BIG CINEMA' as 'Department'
UNION  ALL  SELECT  'Big Bank' as 'EmpName', 101 as 'Emp_Salary', 'BIG CINEMA' as 'Department'
UNION  ALL  SELECT  'Big and Bold' as 'EmpName', 0 as 'Emp_Salary', 'BIG CINEMA' as 'Department'</SqlCommand>
      </Data2>
    </DataSources>
    <Relations isList="true" count="0" />
    <Report isRef="0" />
    <Resources isList="true" count="0" />
    <Variables isList="true" count="1">
      <value>,ValuedRows,ValuedRows,ValuedRows,System.Int32,_x0030_,False,False,False,False</value>
    </Variables>
  </Dictionary>
  <EngineVersion>EngineV2</EngineVersion>
  <GlobalizationStrings isList="true" count="0" />
  <MetaTags isList="true" count="0" />
  <Pages isList="true" count="1">
    <Page1 Ref="4" type="Page" isKey="true">
      <Border>None;Black;2;Solid;False;4;Black</Border>
      <Brush>Transparent</Brush>
      <Components isList="true" count="4">
        <PageFooterBand1 Ref="5" type="PageFooterBand" isKey="true">
          <Brush>Transparent</Brush>
          <ClientRectangle>0,23.5,19,4.2</ClientRectangle>
          <Components isList="true" count="1">
            <Text6 Ref="6" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>0,0.1,19,4</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,10</Font>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text6</Name>
              <Page isRef="4" />
              <Parent isRef="5" />
              <Text>PLEASE LOOK HOW WE ARE HIDING GROUP FOOTER BAND - THE SAME LOGIC DOES NOT WORK IN GROUP HEADER.
ALSO HOW WE ARE HIDING DATABAND WHERE EMPLOYEE HAS NO SALARY - THE SAME LOGIC DOES NOT WORK IN GROUP HEADER
BUT CountDistinct Show properly the numbers of emp in each group. We want if it is equal to 0, hide it.
BECAUSE WE have page break on each group</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text6>
          </Components>
          <Conditions isList="true" count="0" />
          <Name>PageFooterBand1</Name>
          <Page isRef="4" />
          <Parent isRef="4" />
        </PageFooterBand1>
        <GroupHeaderBand1 Ref="7" type="GroupHeaderBand" isKey="true">
          <BeforePrintEvent>ValuedRows = 0;</BeforePrintEvent>
          <Brush>[192:80:77]</Brush>
          <ClientRectangle>0,0.4,19,0.8</ClientRectangle>
          <Components isList="true" count="3">
            <Text5 Ref="8" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>1,0,3.6,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <Guid>cb4bd6c283e94205a939c552a6ede595</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text5</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Text>Dep: {Data2.Department}</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text5>
            <Text3 Ref="9" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>7,0,3.6,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <Guid>9f5b99e086f84dd7beab04a086c2c1b8</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text3</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Text>{CountDistinct(Data2.EmpName)}</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text3>
            <Text8 Ref="10" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>11.6,0,3.6,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <Guid>ae92fac4622b4c3eaf20339e08f53fbf</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text8</Name>
              <Page isRef="4" />
              <Parent isRef="7" />
              <Text>How to hide it?</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text8>
          </Components>
          <Condition>{Data2.Department}</Condition>
          <Conditions isList="true" count="1">
            <value>_x007B_ValuedRows_x0020__x003D__x003D__x0020_0_x007D_,Red,Transparent,Arial_x002C_8,False,False,,,None</value>
          </Conditions>
          <Name>GroupHeaderBand1</Name>
          <NewPageBefore>True</NewPageBefore>
          <Page isRef="4" />
          <Parent isRef="4" />
          <SortDirection>None</SortDirection>
        </GroupHeaderBand1>
        <DataBand1 Ref="11" type="DataBand" isKey="true">
          <BeforePrintEvent>if(Data2.Emp_Salary != 0) {
	ValuedRows += 1;
}</BeforePrintEvent>
          <Brush>[79:129:189]</Brush>
          <BusinessObjectGuid isNull="true" />
          <ClientRectangle>0,2,19,0.8</ClientRectangle>
          <Components isList="true" count="4">
            <Text1 Ref="12" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>3.6,0,3.6,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text1</Name>
              <Page isRef="4" />
              <Parent isRef="11" />
              <Text>{Data2.EmpName}</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text1>
            <Text2 Ref="13" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>8,0,3.6,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <Guid>6913490c244943e68994371f76810daa</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text2</Name>
              <Page isRef="4" />
              <Parent isRef="11" />
              <Text>{Data2.Emp_Salary}</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text2>
            <Text7 Ref="14" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>12.6,0,5.4,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <Guid>4a14b440f1af4f2494ab508e6f53929d</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text7</Name>
              <Page isRef="4" />
              <Parent isRef="11" />
              <Text>CAN BE HIDDEN BE COndition only</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text7>
            <Text9 Ref="15" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>0,0,3.6,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,7</Font>
              <Guid>057cd88e72f741f1825c5b9cd12aaca9</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text9</Name>
              <Page isRef="4" />
              <Parent isRef="11" />
              <Text>Dep: {Data2.Department}</Text>
              <TextBrush>Black</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text9>
          </Components>
          <Conditions isList="true" count="1">
            <value>_x007B_Data2.Emp_Salary_x0020__x003D__x003D__x0020_0_x007D_,Red,Transparent,Arial_x002C_8,False,False,,,None</value>
          </Conditions>
          <DataRelationName isNull="true" />
          <DataSourceName>Data2</DataSourceName>
          <Filters isList="true" count="0" />
          <Name>DataBand1</Name>
          <Page isRef="4" />
          <Parent isRef="4" />
          <Sort isList="true" count="0" />
        </DataBand1>
        <GroupFooterBand1 Ref="16" type="GroupFooterBand" isKey="true">
          <Brush>[192:80:77]</Brush>
          <ClientRectangle>0,3.6,19,1</ClientRectangle>
          <Components isList="true" count="1">
            <Text4 Ref="17" type="Text" isKey="true">
              <Border>None;[231:232:234];1;Solid;False;4;[0:0:0:0];True</Border>
              <Brush>Transparent</Brush>
              <ClientRectangle>0,0,18.8,0.8</ClientRectangle>
              <Conditions isList="true" count="0" />
              <Font>Tahoma,10</Font>
              <Guid>580d39e6a48140a1a6df81da3664e7fb</Guid>
              <HorAlignment>Center</HorAlignment>
              <Margins>0,0,0,0</Margins>
              <Name>Text4</Name>
              <Page isRef="4" />
              <Parent isRef="16" />
              <Text>1)Universal has paid salaries but no group header! 3) Marvel has no paid salaries but has header to Big Cinema dep</Text>
              <TextBrush>White</TextBrush>
              <Type>Expression</Type>
              <VertAlignment>Center</VertAlignment>
            </Text4>
          </Components>
          <Conditions isList="true" count="1">
            <value>_x007B_ValuedRows_x0020__x003D__x003D__x0020_0_x007D_,Red,Transparent,Arial_x002C_8,False,False,,,None</value>
          </Conditions>
          <Name>GroupFooterBand1</Name>
          <Page isRef="4" />
          <Parent isRef="4" />
        </GroupFooterBand1>
      </Components>
      <Conditions isList="true" count="0" />
      <Guid>ba26d2a077d74533a1867ea999b2d32a</Guid>
      <Margins>1,1,1,1</Margins>
      <Name>Page1</Name>
      <PageHeight>29.7</PageHeight>
      <PageWidth>21</PageWidth>
      <Report isRef="0" />
      <Watermark Ref="18" type="Stimulsoft.Report.Components.StiWatermark" isKey="true">
        <Font>Arial,100</Font>
        <TextBrush>[50:0:0:0]</TextBrush>
      </Watermark>
    </Page1>
  </Pages>
  <PrinterSettings Ref="19" type="Stimulsoft.Report.Print.StiPrinterSettings" isKey="true" />
  <ReferencedAssemblies isList="true" count="8">
    <value>System.Dll</value>
    <value>System.Drawing.Dll</value>
    <value>System.Windows.Forms.Dll</value>
    <value>System.Data.Dll</value>
    <value>System.Xml.Dll</value>
    <value>Stimulsoft.Controls.Dll</value>
    <value>Stimulsoft.Base.Dll</value>
    <value>Stimulsoft.Report.Dll</value>
  </ReferencedAssemblies>
  <ReportAlias>Report</ReportAlias>
  <ReportChanged>8/1/2018 4:29:22 PM</ReportChanged>
  <ReportCreated>7/30/2018 10:56:00 AM</ReportCreated>
  <ReportFile>D:\Chrome Downloads\HideEmptyHeaders.mrt</ReportFile>
  <ReportGuid>1c04546e723c43e4a192f01641768521</ReportGuid>
  <ReportImage isNull="true" />
  <ReportName>Report</ReportName>
  <ReportUnit>Centimeters</ReportUnit>
  <ReportVersion>2017.1.6.0</ReportVersion>
  <Script>using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;

namespace Reports
{
    public class Report : Stimulsoft.Report.StiReport
    {
        public Report()        {
            this.InitializeComponent();
        }

        #region StiReport Designer generated code - do not modify
		#endregion StiReport Designer generated code - do not modify
    }
}
</Script>
  <ScriptLanguage>CSharp</ScriptLanguage>
  <Styles isList="true" count="0" />
</StiSerializer>