Getting all used columns in the report
Getting all used columns in the report
My reports are usually created using wizard mode. In that, report creator can select all or just few columns to report on. Since these reports are large, when actual data is fetched for preview or running the report, I want to get only those columns data that are used in the report. How do I loop through dictionary object and get column names that are used in the report. Please help.
Re: Getting all used columns in the report
Hello,
You can use the following method:
Thank you.
You can use the following method:
Code: Select all
StiDataSourceHelper.GetUsedDataSourcesNames()
Re: Getting all used columns in the report
That is great to get used data source names. How about actual used columns within that datasource. How do I get that?
Re: Getting all used columns in the report
Hello.
The Data sources should be created before running wizard. And it's possible to select columns in the SQL query only.
So it's impossible to implement such feature. It's better to set necessary fields only.
Thank you.
The Data sources should be created before running wizard. And it's possible to select columns in the SQL query only.
So it's impossible to implement such feature. It's better to set necessary fields only.
Thank you.
Re: Getting all used columns in the report
Oh no. I was really hoping there is easy way to get used columns. In wizard, we provided more than 50 fields to choose from. Running a query for each of them will be very expensive. It looks like the only good solution would be to not use wizard at all and do same thing outside of reporting and once fields are selected, then redirect user to report designer. Thanks Aleksey. Its not a deal breaker to me.
Re: Getting all used columns in the report
Hello.
After finish of creating report with wizard it's possible that users will need to add of replace some fields. So it's not right to remove fields from Dictionary automatically even if it would be possible.
Thank you.
After finish of creating report with wizard it's possible that users will need to add of replace some fields. So it's not right to remove fields from Dictionary automatically even if it would be possible.
Thank you.
Re: Getting all used columns in the report
That is a great point. And I did think about it. I will have to maintain a collection somehow to keep track of actual fields used whether from wizard or later when report is saved. I own the source code now, so sooner or later I will learn to make this work. If you have an idea how to scan designer to get used fields, let me know.
Re: Getting all used columns in the report
Hello.
There is a method in StiDictionary that removes unused data sources. It's name RemoveUnusedDataSourcesV2().
You could use it to create your method to remove fields.
Thank you.
There is a method in StiDictionary that removes unused data sources. It's name RemoveUnusedDataSourcesV2().
You could use it to create your method to remove fields.
Thank you.