Corrupted SSRS report rendered when generated from SSIS - reporting-services

I have an SSIS 2008 package that is reading data from multiple excel files, performing transformation and generating output in an excel file. I'm then using that output excel file as data source to call an SSRS 2008 report hosted on localhost through the same SSIS package as Script Task and exporting it as pdf and xls reports. The reports are getting generated but are of small size and corrupted.
When I run the same report from BIDS 2008 and export it to pdf or xls, it works fine.
The report has one parameter. SSIS execute script task is contained in a foreach loop container and passes that parameter one-by-one to generate 30 odd reports.
Would appreciate if someone could provide some help on this.

Related

Create SSRS Subscription to XLTX (Excel Template)

I am trying to get the subscription for SSRS to send the CSV data to an existing Excel template so that the data is formatted to our excel reports and all the conditional formatting in them every morning but it's just creating a new file. How do I send the data to a specific template file?
While SSRS doesn't have built-in functionality for exporting directly to an Excel template, I have a suggestion for a workaround. Use SSRS to export the data in CSV or Excel format. Then, in the Excel template file, go to the Data menu and select Get Data > From File. This lets you use Excel's built-in Power Query functionality to reference the exported file as a data source.
One of the benefits of this approach is that to get fresh data all you need to do is overwrite the data file and then click "Refresh All" in your Excel file. You can also take advantage of the transformation functions that are available in Power Query to avoid repetitive cleanup tasks if needed.

How do I export an SSRS report to a pdf file in a batch job using X++?

Is it possible to generate an SSRS report in Dynamics AX 2009 and save it as a pdf file using X++ ?
The problem I have is that I need to generate the data for the report and then generate the report. Reporting server subscriptions wont work in this case as there is no way for them to call the x++ to generate the data.
I have also had a look at passing the rendering type to the SSRS report in the URL, but it doesnt seem to accept a filename to save the report as.
The logic that generates the data is not a straightforward query, and takes quite a while to run. I want to be able to turn this into a batch process so that several reports can be generated by a batch server.
Ensure that AX is configured as a batch server and then you will need to create a batch job.
The art of creating a batch class (for the batch job to call) which calls a report and generates a pdf file overnight has already been mastered here.
The following snippet for generating a PDF file is from the class EPSendDocument.makeDocument()
Filename file = "\\\\Server\\SharedFolder\\File.pdf";
printSettings = reportRun.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.fileName(file);
printSettings.overwriteFile(true);
Another link for converting a report to a pdf file.
Finally do check first if the files are generated by executing the class from within your AX client, and then when it is run on the batch server. There may be permission or path issues.

Can we have the mapping for OleDB Source to Excel Destination at runtime rather than at design time?

I am trying to create a SSIS package that will export csv data to an excel file. This package will be called up from C# giving the csv file as input to the package. I am quite new to SSIS and I've been able to produce the expected result with same headers.
I went with the following approach -
Script task - created scripts from the csv headers to create temp table, bulk insert, excel table scripts.
Execute SQL Task - created a temp table in database
Execute SQL Task - Bulk insert csv data into table
Execute SQL Task - Create Excel file
Data Flow Task - OleDB Source to Excel Destination
Execute SQL Task - Drop the temp table created
The challenge I am facing is that my csv may have different headers (both text and number of headers may be different). And I want a single package to serve this purpose.
With the headers being different, the mapping between OleDB Souce to Excel Destination in step 5 above is not working for dynamic headers and is giving unexpected results in the excel output. Is there any way these mappings can be decided at runtime and not at design time.
I don't believe that you can specify the columns or column mappings of a Data Flow at SSIS runtime. You could build the SSIS package on-the-fly, which would allow your C# code to create the column mappings, but the mappings have to be created before the package can run. See Building Packages Programmatically in MSDN for details.
On the other hand, if all you're trying to do is convert a CSV file into an Excel spreadsheet, it would seem logical to me to use the Workbook.SaveAs method of the Office object model.

ssis 2008, delete contents from excel

im using SSIS for SQL Server 2008.
My SSIS package grabs data from sql and exports it to an excel file. But everytime it does this I want new data on the excel.
The problem right now is, If i execute the package more than one time I will have the old data plus the new one on the excel file. I only want the new data displayed.
On the SSIS, on the Control Flow tab I have an Data Flow task. On the Data Flow tab I have an OLEDB source and an Excel Destination in order to put the data on the excel.
So im thinking on deleting the contents from the excel on the SSIS every time before the data gets inserted on the excel.
The excel file has an image, a title and the column names. I want these data to stay.
But I want the data from the rows deleted.
How can I do this?
Thanks...
Ok. What I did was to make a copy of the file and load the data on the new file, and everytime the ssis loads it overwrites the file, so I always have new data..........Thanks!!

How can I go throught every tab in Excel file to evaluate header value in SSIS

I've a SSIS solution to import data from Excel file to SQl Server table.
But the Excel file have differents tabs and I need to go for each one evaluating the header value for A1 cell, if it's for sample "Appointment Count", that is the tab I have to imported.
some idea how can I do it?
thanks
Eliana
You can create an OLEDB connection manager, using the Microsoft Jet Provider to open the Excel file. From there, you can create a For Each loop container to iterate through the worksheets therein.
For an example of how to implement this, check here.
*Remember that the MS Jet provider is available in 32-bit only.