简体   繁体   中英

Compare SSRS report values with C# variables

I have to compare data contained in rendered SSRS report (chart and tablix values for example) with variables stored in a C# application. How can it be done?

So far I know only about generating report in Xml and parsing the Xml to get the desired data. Is there an easier way to achieve that without any user interaction? Alternatively, is there a way to drop report chart/tablix data to an array or list in C#?

You have one special requirement there... it might help if you tell us why you want this, because there may well be other solutions to your actual problem .

Having said that, if you want to "compare data contained in rendered SSRS reports" to "variables stored in C#", you probably have the best approach already. Given that approach, you seem to suppose that there's user interaction needed to generate the XML, but it's not: there's the SSRS Web Service where you can run reports without users intervening. The render method allows you to specify the format:

Format
Type: System.String
The format in which to render the report. This argument maps to a rendering extension. Supported extensions include XML, NULL, CSV, IMAGE, PDF, HTML4.0, HTML3.2, MHTML, EXCEL, and Word.

Guessing at your actual case being the need to check if the report data is "correct" by comparing it to C#-generated data, I'd suggest a different approach though. Place as much data-logic as you can in Views or Stored Procs, use those in your reports, and in C# compare your calculated results to the results read from the View through something like ADO.NET. Much easier than parsing SSRS XML reports (though a bit less reliable, because SSRS may still screw up interpretation of the data).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM