Erick's Blog
  • Home
  • Blog
  • Apps
    • Mortgage Calculator
  • PowerShell
    • Blog & Examples
    • Excel Reference
  • Windchill
    • Document Exporter
    • Document Worker
    • E.P.L.E.S.
    • Export Released
    • Property Checker
    • Windchill Business Analytics >
      • Part 01 - Program Logic
      • Part 02 - Getting Data with SQL Queries
      • Part 03 - Automating SQL Queries
      • Part 04 - Converting SQL Results to XML
      • Part 05 - Data Processing and Manipulation
      • Part 06 - Displaying XML in HTML
      • Part 07 - Auto Updating Displayed Data
      • Part 08 - Hosting Webpage with an Existing Apache Installation
      • Part 09 - Running Multiple Queries In Sequence
      • Part 10 - Calculating Data Trends
      • Part 11 - Making It Modular
    • Windchill Quick View
  • Reviews
  • Music
  • Contact

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.
Picture
Generated XML with Data Processing Test 1
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).

Previous: Converting SQL Results to XML
W.B.A. â€‹Home
Next: Displaying XML in HTML
Copyright © 2018 Erick Johnson
  • Home
  • Blog
  • Apps
    • Mortgage Calculator
  • PowerShell
    • Blog & Examples
    • Excel Reference
  • Windchill
    • Document Exporter
    • Document Worker
    • E.P.L.E.S.
    • Export Released
    • Property Checker
    • Windchill Business Analytics >
      • Part 01 - Program Logic
      • Part 02 - Getting Data with SQL Queries
      • Part 03 - Automating SQL Queries
      • Part 04 - Converting SQL Results to XML
      • Part 05 - Data Processing and Manipulation
      • Part 06 - Displaying XML in HTML
      • Part 07 - Auto Updating Displayed Data
      • Part 08 - Hosting Webpage with an Existing Apache Installation
      • Part 09 - Running Multiple Queries In Sequence
      • Part 10 - Calculating Data Trends
      • Part 11 - Making It Modular
    • Windchill Quick View
  • Reviews
  • Music
  • Contact