开发者

How to configure an Export Option in Reporting Services for Text export with no separators?

开发者 https://www.devze.com 2023-03-16 11:52 出处:网络
There\'s the need to send data to an external interface - a financial statutory report to be sent periodically for some country\'s government which expects data as text files with no separator between

There's the need to send data to an external interface - a financial statutory report to be sent periodically for some country's government which expects data as text files with no separator between fields: fixed width, left-padded with zeros or blank spaces (depending on data type) to fill the space.

So we created an RDL with the required fields and were looking at adding an export option in for this.

Can an export option be created to export in this format?

We'd like to avoid having to CAST all appropriate fields to NVARCHAR in the stored procedure that feeds the report, left-pad them there and finally concatenate everything - unless that's the only option to accomplish it.

Also, we definitely don't want to code an ad-hoc export method in .NET, there won't be much reports with this exporting option so it's not worth it. Besides it's not so easy to convince the server team to deploy DLLs to servers - if there's something already coded, open source or shareware, we could have a look onto it though wouldn't be the preferred solution.

Previously we had been able to configure the XML configuration file for Reporting Services 2008 to开发者_Python百科 add a new export option for export to Text with fields separated by pipes, so were thinking to try this first. Unfortunately discovered if you use the Text or CSV export motors but specify no separator, comma is used by default.

Any ideas?


In my opinion, Reporting Services isn't the right tool for this job. You're trying to bend a reporting tool into a data migration tool. While on the surface I guess it looks similar - outputing formatted data - the structure of the fixed length text file isn't really what Reporting Services is good at producing out of the box. We do a similar fixed length export using a scheduled SQL Server Agent job. You could also write a console app and run it manually or use Windows Scheduled Tasks to run it.

If you're determined to use Reporting Services for some functionality reason (for example, the export has to use the same parameters to filter the data as the report that is being viewed) then I'd simply create a second report based on the first with no header or footer, just a detail section with a table containing one wide field with an expression in it that creates the formatted text you need for your export. Put a link in the header of the main report called "Create export file" that links to this new report and passes the parameters across then export it to some non-paginating format like CSV.

Otherwise, you're looking at creating a custom renderer which you don't want to do and I agree is overkill for this.

0

精彩评论

暂无评论...
验证码 换一张
取 消