**Resolved** Info 14.1 SP2 - How to conditionally hide a DataTable Row?
I am creating a table with Sums of "encounter" values across "services". I need to count all encounters but hide the row (if one exists) for which no services exist. I'm able to do this with CSS in the web output, but PDF/Excel ignore the CSS and show the row anyway.
Any ideas on how to keep a row in the DataTable's DataLayer but not show the row in the DataTable itself? Here is a reproducer with the CSS and export links:
<?xml version="1.0" encoding="utf-8"?>
<Report
ID="TestHideRow"
>
<Body>
<DataTable
ID="dt1"
>
<DataLayer
ID="dls1"
Type="Static"
>
<StaticDataRow
encounter="1"
service="01.01"
/>
<StaticDataRow
encounter="36"
service=""
/>
<StaticDataRow
encounter="47"
service="02.01.01"
/>
<StaticDataRow
encounter="49"
service="03"
/>
<StaticDataRow
encounter="123"
service="01.01"
/>
<GroupFilter
GroupColumn="service"
ID="grpService"
KeepGroupedRows="False"
>
<GroupAggregateColumn
AggregateColumn="encounter"
AggregateFunction="Count"
ID="ctEncounter"
/>
</GroupFilter>
<AggregateColumn
AggregateColumn="ctEncounter"
AggregateFunction="Sum"
ID="sumEncounter"
/>
</DataLayer>
<HeaderRow
HeaderPosition="Top"
ID="hdr1"
>
<Column
ID="hdrCol1"
>
<Label
Caption="Total:"
/>
</Column>
<Column
ID="hdrCol2"
>
<Label
Caption="@Data.sumEncounter~"
/>
</Column>
</HeaderRow>
<DataTableColumn
Header="Services"
ID="dtcService"
>
<Label
Caption="=IIF('@Data.service~'='','No Service','@Data.service~')"
/>
</DataTableColumn>
<DataTableColumn
Header="Encounters"
ID="dtcEncounters"
>
<Label
Caption="@Data.ctEncounter~"
/>
</DataTableColumn>
</DataTable>
<LineBreak/>
<Label
Caption="I need the total to reflect all 5 of the encounters, but I want to hide the first row (showing no service value)."
/>
<LineBreak/>
<Label
Caption="I can do this with CSS for web, but Excel/PDF ignores this CSS Script and shows the "No Service" row.
<style>
tr:has(#divNoService_Row1) {
display:none;
}
</style>
Is there some way for me to hide the row in web, PDF, and Excel?"
Format="Preserve Line Feeds"
/>
<LineBreak
LineCount="2"
/>
<DataTable
ID="dt2"
>
<DataLayer
ID="dls2"
Type="Static"
>
<StaticDataRow
encounter="1"
service="01.01"
/>
<StaticDataRow
encounter="36"
service=""
/>
<StaticDataRow
encounter="47"
service="02.01.01"
/>
<StaticDataRow
encounter="49"
service="03"
/>
<StaticDataRow
encounter="123"
service="01.01"
/>
<GroupFilter
GroupColumn="service"
ID="grpService"
KeepGroupedRows="False"
>
<GroupAggregateColumn
AggregateColumn="encounter"
AggregateFunction="Count"
ID="ctEncounter1"
/>
</GroupFilter>
<AggregateColumn
AggregateColumn="ctEncounter1"
AggregateFunction="Sum"
ID="sumEncounter1"
/>
</DataLayer>
<HeaderRow
HeaderPosition="Top"
ID="hdr1"
>
<Column
ID="hdrCol1"
>
<Label
Caption="Total:"
/>
</Column>
<Column
ID="hdrCol2"
>
<Label
Caption="@Data.sumEncounter1~"
/>
</Column>
</HeaderRow>
<DataTableColumn
Header="Services"
ID="dtcService1"
>
<Division
Condition="'@Data.service~'<>''"
HtmlDiv="True"
ID="divService"
>
<Label
Caption="@Data.service~"
/>
</Division>
<Division
Condition="'@Data.service~'=''"
HtmlDiv="True"
ID="divNoService"
>
<Label
Caption="No Service"
/>
</Division>
</DataTableColumn>
<DataTableColumn
Header="Encounters"
ID="dtcEncounters1"
>
<Label
Caption="@Data.ctEncounter1~"
/>
</DataTableColumn>
</DataTable>
<LineBreak
LineCount="2"
/>
<Label
Caption="Excel"
>
<Action
ID="expExcel"
Type="NativeExcel"
>
<Target
ExcelOutputFormat="Excel2007"
FrameID="NewWindow"
ID="tgtExcel"
Type="NativeExcel"
/>
</Action>
</Label>
<LineBreak/>
<Label
Caption="PDF"
>
<Action
ID="expPdf"
Type="PDF"
>
<Target
FrameID="NewWindow"
ID="tgtPDF"
Type="PDF"
/>
</Action>
</Label>
<IncludeHtml
Html="<style>
tr:has(#divNoService_Row1) {
display:none;
}
</style>"
/>
</Body>
<ideTestParams/>
</Report>
-
Logi does not provide a means to hide a DataTable Row using a Conditional Class or such.
The reason your CSS doesn't work upon export is that the :has() selector does not have consistent browser support. The Logi Export Engine most likely does not support this selector.
I am not understanding why you need to maintain the row in the datasource once all of the calculations and summaries have been completed. Logi will perform elements in the order in which they are displayed. If you place your compare filter below you Summary, it will be processed afterwards.
This solution will persist to your export as well.<Report ID="newReport3">
<Body>
<DataTable ID="dt2">
<DataLayer ID="dls2" Type="Static">
<StaticDataRow encounter="1" service="01.01" />
<StaticDataRow encounter="36" service="" />
<StaticDataRow encounter="47" service="02.01.01" />
<StaticDataRow encounter="49" service="03" />
<StaticDataRow encounter="123" service="01.01" />
<GroupFilter GroupColumn="service" ID="grpService" KeepGroupedRows="False">
<GroupAggregateColumn AggregateColumn="encounter" AggregateFunction="Count" ID="ctEncounter1" />
</GroupFilter>
<AggregateColumn AggregateColumn="ctEncounter1" AggregateFunction="Sum" ID="sumEncounter1" />
<CompareFilter CompareType="<>" DataColumn="service" ID="cfservice" />
</DataLayer>
<HeaderRow HeaderPosition="Top" ID="hdr1" IdeDisplayStatus="Collapsed">
<Column ID="hdrCol1">
<Label Caption="Total:" />
</Column>
<Column ID="hdrCol2">
<Label Caption="@Data.sumEncounter1~" />
</Column>
</HeaderRow>
<DataTableColumn Header="Services" ID="dtcService1">
<Division Condition="'@Data.service~'<>''" HtmlDiv="True" ID="divService" IdeDisplayStatus="Collapsed">
<Label Caption="@Data.service~" />
</Division>
<Division Condition="'@Data.service~'=''" HtmlDiv="True" ID="divNoService">
<Label Caption="No Service" />
</Division>
</DataTableColumn>
<DataTableColumn Header="Encounters" ID="dtcEncounters1">
<Label Caption="@Data.ctEncounter1~" />
</DataTableColumn>
</DataTable>
<LineBreak LineCount="2" />
<Label Caption="Excel">
<Action ID="expExcel" Type="NativeExcel">
<Target ExcelOutputFormat="Excel2007" FrameID="NewWindow" ID="tgtExcel" Type="NativeExcel" />
</Action>
</Label>
<LineBreak />
<Label Caption="PDF">
<Action ID="expPdf" Type="PDF">
<Target FrameID="NewWindow" ID="tgtPDF" Type="PDF" />
</Action>
</Label>
</Body>
<ideTestParams />
</Report>0 -
OMG, thank you! I had my booster yesterday and I've been a little foggy today. I knew I was overthinking this!!!
Thanks again VISUI
0
Please sign in to leave a comment.
Comments
2 comments