Hi,
As the title say, I'm trying to create a report which could contain pretty much any number of columns...
I would allow the user to decide which columns they want in their report. The subset of columns chosen by users will usually be 6-7, but could theoretically be much more.
Fitting in a page for printing would be nice, but isn't that important since most users will export reports to Excel.
Before I've "solved" this problem by adding lots of columns, like this:
and hiding the columns the user does not want to have in their report.
It wouldn't really work in this case, though, since users couldn't add any number of columns...
Any help/references on how to fix this problem would be greatly appreciated!
Report with variable number of columns
-
- Posts: 6244
- Joined: Tue Mar 20, 2018 5:34 am
Re: Report with variable number of columns
Hello,
You can use Conditions with "Component Is Enabled" option.
Please check the sample report in the attachment.
Thank you.
You can use Conditions with "Component Is Enabled" option.
Please check the sample report in the attachment.
Thank you.
- Attachments
-
- SelectingColumns_Variables.mrt
- (813.15 KiB) Downloaded 136 times
Re: Report with variable number of columns
Hello,
Thank you for you response. Unfortunately, I don't think this would work for me. I don't want to only hide columns the users do not want to see... I want users to be able to add any number of columns they want.
If I use your sample, it would be like if users could add custom properties to products. Some properties such as ProductID, ProductName, SupplierID, etc. would always be there. But users could add some custom properties. For example:
Client #1 could add custom properties like "Comments", "Rating". Client #2 could add the properties "Notes" and "Details".
It's impossible for me to add those columns in the MRT, because I have no idea what they are, and they can change from one client to the other. (e.g Client #1 might want ProductID, ProductName and Comments while Client #2 needs ProductID, ProductName, SupplierID, Comments and Rating.)
Thank you for you response. Unfortunately, I don't think this would work for me. I don't want to only hide columns the users do not want to see... I want users to be able to add any number of columns they want.
If I use your sample, it would be like if users could add custom properties to products. Some properties such as ProductID, ProductName, SupplierID, etc. would always be there. But users could add some custom properties. For example:
Client #1 could add custom properties like "Comments", "Rating". Client #2 could add the properties "Notes" and "Details".
It's impossible for me to add those columns in the MRT, because I have no idea what they are, and they can change from one client to the other. (e.g Client #1 might want ProductID, ProductName and Comments while Client #2 needs ProductID, ProductName, SupplierID, Comments and Rating.)
-
- Posts: 6244
- Joined: Tue Mar 20, 2018 5:34 am
Re: Report with variable number of columns
Hello,
In that case, these columns should be in the dictionary, you should add it in your data source and provide it to the report.
Thank you.
In that case, these columns should be in the dictionary, you should add it in your data source and provide it to the report.
Thank you.
Re: Report with variable number of columns
How do I do that programmatically? I see how to add columns in the MRT file, but not how to add them dynamically in the code. I want to be able to display any number of columns, that can have any names,all decided by the user at run time in my application.
-
- Posts: 6244
- Joined: Tue Mar 20, 2018 5:34 am
Re: Report with variable number of columns
Hello,
You can add necessary columns in the DataTable and the provide it to the report with RegData() method.
Thank you.
You can add necessary columns in the DataTable and the provide it to the report with RegData() method.
Thank you.