Report Excel Export Cleanup
Hii
Currently I am using the data table for the report, I want to allow Logi Reports to be customizable by being able to remove certain columns that you do not want exported .
Thanks in advance
Seema
-
Hi Akhil,
It sounds like you will need some UI element to allow users to check/uncheck which columns they want to appear on the Excel export.
I am using an InputCheckboxList (ICL) with CheckboxListDropdown="False" for this type of use case in one of my reports. I am populating the ICL with the column names and using a DefaultValues element to set them all to checked (1). When the user unchecks (0), you have a few options -
- If you don't want to change the web output, do nothing, but be sure to pass the ICL's Request token to your Excel export and add logic to your Excel to include only those columns with checked=1
- If you want to change the web output, you can use an EventHandler to apply the unchecks immediately or a 'trigger' element (like an "Apply" button) to apply the unchecks. Again, passing the ICL Request token to the rdBrowser and rdExport outputs.
Regards,
Johnny0 -
Hi Johnny,
Do you have a sample report for the above solution.
Thanks
0 -
I'm attaching a working sample. I have remarked an EventHandler which you can unremark if you want to change the web table when the user makes column selections. You would also need to copy the Column element Conditions from dtExport to dtWeb to show/hide the columns based on the user's selections.
Let me know if you have questions.
Regards,
Johnny<?xml version="1.0" encoding="utf-8"?>
<Report
ID="TestHideColumns"
>
<Body>
<Division
HtmlDiv="True"
ID="divInput"
ShowModes="rdBrowser"
>
<Label
Caption="Columns to Show in Export"
Class="ThemeBold"
/>
<LineBreak/>
<InputCheckboxList
CheckAllCaption="Select/De-Select All"
CheckboxListDropdown="False"
DefaultValue="@Request.inpSHColumns~"
ID="inpSHColumns"
MultiSelect="True"
OptionCaptionColumn="name"
OptionValueColumn="id"
>
<DataLayer
ID="dlsSortColumns"
Type="Static"
>
<StaticDataRow
id="ProductName"
name="Product Name"
/>
<StaticDataRow
id="CategoryId"
name="Category"
/>
<StaticDataRow
id="ProdYear"
name="Product Year"
/>
<StaticDataRow
id="ManufDate"
name="Manufacture Date"
/>
<DataLayerLink
ID="dllSHColumns"
/>
</DataLayer>
<Note
Note="The id should match whatever you use in the Column Conditions. If you want to number your columns and make id numeric to match, that will work, too. The name is what will show in the Input Checkbox List."
/>
<DefaultValues
DataColumn="id"
ID="dftAll"
>
<DataLayer
ID="linkAllSHColumns"
LinkedDataLayerID="dllSHColumns"
Type="Linked"
/>
</DefaultValues>
<Remark>
<EventHandler
DhtmlEvent="onchange"
>
<Action
ElementID="divOutput"
ID="actUpdateTable"
Type="RefreshElement"
>
<LinkParams
inpSort2=""
inpSort3=""
inpSubmit="0"
/>
<WaitPage/>
</Action>
<Note
Note="Use this if you want to change the web table with User Input click"
/>
<Note
Note="You would also need to add the Column Conditions to dtWeb's Column elements to show/hide the columns on click"
/>
</EventHandler>
</Remark>
</InputCheckboxList>
<LineBreak/>
<Label
Caption="Export"
>
<Action
ID="actExcel"
Type="NativeExcel"
>
<Target
ShowGridlines="True"
Type="NativeExcel"
>
<WaitPage/>
</Target>
</Action>
</Label>
</Division>
<Division
HtmlDiv="True"
ID="divOutputWeb"
ShowModes="rdBrowser"
>
<DataTable
ID="dt1"
>
<DataLayer
ID="dlProducts"
Type="Static"
>
<StaticDataRow
CategoryId="10"
ManufDate="04/30/2006"
ProductName="Goodyear Tires"
ProdYear="2007"
/>
<StaticDataRow
CategoryId="10"
ManufDate="12/20/2019"
ProductName="Rockwell Tires"
ProdYear="2020"
/>
<StaticDataRow
CategoryId="15"
ManufDate="10/01/2020"
ProductName="Dual Action Steering Wheel"
ProdYear="2020"
/>
<StaticDataRow
CategoryId="20"
ManufDate="01/03/2010"
ProductName="Dashboard Bobblehead"
ProdYear="2018"
/>
</DataLayer>
<DataTableColumn
Header="Product"
ID="colProd"
>
<Label
Caption="@Data.ProductName~"
/>
</DataTableColumn>
<DataTableColumn
Header="Category ID"
ID="colCat"
>
<Label
Caption="@Data.CategoryId~"
/>
</DataTableColumn>
<DataTableColumn
Header="Product Year"
ID="colProdYr"
>
<Label
Caption="@Data.ProdYear~"
/>
</DataTableColumn>
<DataTableColumn
Header="Manufacture Date"
ID="colManufDate"
>
<Label
Caption="@Data.ManufDate~"
Format="yyyy-MM-dd"
/>
</DataTableColumn>
</DataTable>
</Division>
<Division
HtmlDiv="True"
ID="divOutputExport"
ShowModes="rdExportExcel"
>
<DataTable
ID="dtExport"
>
<DataLayer
ID="dlProducts"
Type="Static"
>
<StaticDataRow
CategoryId="10"
ManufDate="04/30/2006"
ProductName="Goodyear Tires"
ProdYear="2007"
/>
<StaticDataRow
CategoryId="10"
ManufDate="12/20/2019"
ProductName="Rockwell Tires"
ProdYear="2020"
/>
<StaticDataRow
CategoryId="15"
ManufDate="10/01/2020"
ProductName="Dual Action Steering Wheel"
ProdYear="2020"
/>
<StaticDataRow
CategoryId="20"
ManufDate="01/03/2010"
ProductName="Dashboard Bobblehead"
ProdYear="2018"
/>
</DataLayer>
<DataTableColumn
Condition="InStr('@Request.inpSHColumns~','ProductName')<>0"
Header="Product"
ID="colProd"
>
<Label
Caption="@Data.ProductName~"
/>
<ExcelColumnFormat
ExcelColumnWidth="Auto"
/>
</DataTableColumn>
<DataTableColumn
Condition="InStr('@Request.inpSHColumns~','CategoryId')<>0"
Header="Category ID"
ID="colCat"
>
<Label
Caption="@Data.CategoryId~"
/>
<ExcelColumnFormat
DataType="Number"
ExcelColumnWidth="Auto"
/>
</DataTableColumn>
<DataTableColumn
Condition="InStr('@Request.inpSHColumns~','ProdYear')<>0"
Header="Product Year"
ID="colProdYr"
>
<Label
Caption="@Data.ProdYear~"
/>
<ExcelColumnFormat
DataType="Number"
ExcelColumnWidth="Auto"
/>
</DataTableColumn>
<DataTableColumn
Condition="InStr('@Request.inpSHColumns~','ManufDate')<>0"
Header="Manufacture Date"
ID="colManufDate"
>
<Label
Caption="@Data.ManufDate~"
Format="yyyy-MM-dd"
/>
<ExcelColumnFormat
DataType="Date"
ExcelColumnWidth="Auto"
/>
</DataTableColumn>
</DataTable>
</Division>
</Body>
<ideTestParams
inpSHColumns=""
/>
</Report>0
Please sign in to leave a comment.
Comments
3 comments