|
Viewing Data
Well, I've done some investigating and I'm not sure that we are going to be able to get the data directly using the CMS Scripting dlls.
I did a WinGrep of the dll in my CMS directory for the ReportView method and found an example of it in the cvsSCALL.dll (VERY interesting btw). The dll has some good examples of code and how to use the properties and methods. In fact, I THINK (not sure) that this dll is what generates the cvs scripts. If you look at a script and then look at the dll it will start to make sense. When it comes the ReportView VBA.Collection, the dll shows it being used, and it's NOT for retreiving the data from the report.
I will tell you what I've implemented to get the data and how I'm applying it.
I do the reporting for the Help Desk of my organization, and this started out as a way to persist data for a longer period of time (specifically interval data for trending purposes). My system only holds Agent data for about a month before dropping it. We have multiple call centers, so we have to control the size of the database.
Well, to pull daily interval data for about 30 agents is a pain and I needed a way to push it to a SqlServer database. So this is what I've done:
I've wrapped the connection to CMS into a c# class. This allows me to share a single connection with all the reports I'm needing to generate on the fly (about 60-70 interval reports). After about 2 weeks of figuring it out I've finally have it in c# (you can see the method I was attempting from my post above)
After that, I created a report class that would allow me to generate reports as text files. It was a pain at times trying to figure out the right types in c# but everything is working now. One big issue that I had to resolve was the fact that the report objects wanted to stay open as a process even after I was done with them, and .NET wouldn’t take care of them automatically. So I had to figure out a way to release them after I was done with them. It was very simple after I did my research: System.Runtime.InteropServices.Marshal.ReleaseComO bject(object);
I said all that to say this:
I’ve created objects that correspond to specific data that is in the reports I generate. 1. "STAT" object that holds a single line (or period) from an interval report. (things like ACD, ACW, RING, AUX, times etc.); & 2. a "STATS" object that inherits from CollectionBase, and implements the IEnumerable interface. The stats object holds all the stat objects I’m creating. It also has a Populate() method that pulls the reports and parses them into stat objects then adds them to the collection.
In my SqlServer database I have a table that corresponds to the properites of the "STAT" object, and I have a data class that accepts a "STATS" object then adds the "STAT"s to the database.
I know it’s a round-a-bout way to doing this, but it’s the best method I’ve come up with. Besides, most Business Intelligence groups out there have a methodology for an ETL (extract, transform, load) process and that’s basically what I’m doing.
|