Wednesday, March 7, 2012

Export to Fixed Length Format text file without header row.

I am trying to generate a fixed-length format text file from a parameterised
SSRS report for my client and the only way that comnes close seems to be
to save as CSV with a single column query.
I have created a large, parameterised, UNIONed SQL statement to generate
the lines with the correct padding and alignment. This also concatenates
the columns so that the query effectively only returns a single column which
I can then Save As... CSV format. The problem with this is that I always
get a header row. (I concatenated in the query columns to avoid the commas
and quotes that come with CSV exports.)
I have experimented with the Noheader switch on the URL but the effectiveness
of this seems to disappear once the report a) stops for parameter input and
then b) renders to HTML before allowing me to save to CSV. I believe the
NoHeader option will only be effective if I determine my parameters ahead
of time and incorporate them into the URL also and render to CSV on that
URL as well.
All this combines to make for a complicated URL, certainly not something
my client would expect to create manually. Now I could write a small application
to generate offer them available parameters and then to this URL but I am
unsure if this effort is the way to go.
Options appear to be:
* bcp
* DTS
* application to allow users to input params and then generates the URL
* application to simply write the file and remove SSRS from the equation
* custom rendering extension
* purchase some kind of solution
It seems a lot of effort when I could just get them to manually deleted the
header row, however this approach is too unprofessional for my liking.
Ideally I would like to not have my client reliant on my code for new formats
or for when this format changes, hence a report writer based solution would
be great.
What is the best way to export to a fixed-length format text file from a
parameterised SSRS report?
cheers,
Paul.Unfortunately, as far as I am aware, there is no built in feature that
allows you to supress headers when exporting as csv.
As far as reporting services is concerned, the options are like you
said:
a) to build a custom renderer
b) to build a custom interface instead of using the report manager web
application
Both of these will require considerable effort to ultimately remove a
header row from a csv file
c) you could include a text box on the report with a hyperlink to
navigave to the required url (go to properties -> advanced ->
navigate). The user would then have to click on this text box to
download the report as csv with the appropriate noheaders tag. The
navigation url could be built dynamically using the report and
parameter information available from the formula fields, along with
the export format and noheaders tag appended on the end.
I have never tested this solution but it looks feasable if you are
happy for your users to click on a hyperlink to download.
Regards,
Rowen|||One suggestion is that
1. just make one more copy of the same report name it differently
2. In the copy of the report remove the header and keep the detail alone.
3. In the original report give a hyperlink using "Action" and name it
"Export to CSV" (or whater you like)
4. in the textbox ->Action, refer the copy of the report which is without
header using URL.
So what happens is users can also see the report with header and the link
will create the csv without header.
Amarnath
"Paul Ritchie" wrote:
> I am trying to generate a fixed-length format text file from a parameterised
> SSRS report for my client and the only way that comnes close seems to be
> to save as CSV with a single column query.
> I have created a large, parameterised, UNIONed SQL statement to generate
> the lines with the correct padding and alignment. This also concatenates
> the columns so that the query effectively only returns a single column which
> I can then Save As... CSV format. The problem with this is that I always
> get a header row. (I concatenated in the query columns to avoid the commas
> and quotes that come with CSV exports.)
> I have experimented with the Noheader switch on the URL but the effectiveness
> of this seems to disappear once the report a) stops for parameter input and
> then b) renders to HTML before allowing me to save to CSV. I believe the
> NoHeader option will only be effective if I determine my parameters ahead
> of time and incorporate them into the URL also and render to CSV on that
> URL as well.
> All this combines to make for a complicated URL, certainly not something
> my client would expect to create manually. Now I could write a small application
> to generate offer them available parameters and then to this URL but I am
> unsure if this effort is the way to go.
> Options appear to be:
> * bcp
> * DTS
> * application to allow users to input params and then generates the URL
> * application to simply write the file and remove SSRS from the equation
> * custom rendering extension
> * purchase some kind of solution
> It seems a lot of effort when I could just get them to manually deleted the
> header row, however this approach is too unprofessional for my liking.
> Ideally I would like to not have my client reliant on my code for new formats
> or for when this format changes, hence a report writer based solution would
> be great.
> What is the best way to export to a fixed-length format text file from a
> parameterised SSRS report?
> cheers,
> Paul.
>
>
>
>

No comments:

Post a Comment