Windchill Business Analytics: Programming Journal
Part 05: Data Processing and Manipulation
Last Updated: August 14, 2016
I mentioned that using a C# program instead of just SQL would allow me to manipulate the data in ways that will provide users meaningful data that they couldn't get by simple SQL reports. As a simple test, I decided to include a Monthly Average calculation that shows the average amount of data of each object type checked in per month. The new code is below.
You can see that I have added two new variables. The monthAvg array will be used to store the queried data and the ma variable will be used as a simple counter to detect when the reader is going onto a new row. This means a new data set for another object type is about to be read into the while loop.
Note: The monthAvg array could've easily been a simple integer variable that was reset to zero after going to a new data reader row but I chose to make it an array in case I wanted to use the averages for other purposes.
When the above program is ran I get the following updated XML.
Note: The monthAvg array could've easily been a simple integer variable that was reset to zero after going to a new data reader row but I chose to make it an array in case I wanted to use the averages for other purposes.
When the above program is ran I get the following updated XML.
As you can see in the above image, each object type has it's own Monthly Average node. I did a quick manual calculation to make sure it is correct (you should always double check).