In previous version of SSRS Microsoft reporting tool (2005 I believe) , the software would "calculate the gaps" if you will, automatically; making the display more readable and easier to understand . When developing using the 2012 version,I had to take the responsibility to calculate the empty points (in sql) to have a straight line where the software insisted on making it crooked and ugly. The base solution uses various cursors to calculate the "missing data points" and this worked greatly for this scenario but it might not work where speed is top priority. For here is how this was pulled off.:
- First we need a cursor to insert all possible periods, plants into a temp table
- A really important step is to define which points will be displayed(plotted to the graph, the squares where there is data) I simply used a case statement to set a flag to 'S" if there was data and the item needed to be display(be plotted) and 'N' if otherwise. Also, we need to calculate the interval between plots that have data. I do it by using a case statement and simply counting the periods we created above where there is no data . Also for this particular project , there was the need to hide/show some values dependent on whether a period had been closed or not and since the number of products could be huge I had to create my own color pallet to display the line graph since SSRS just repeats the colors once there are so many lines displayed to which I will not take into consideration for this post. This refers to the #Temp table you see below.
- Now we redefine which records have markers.
- Now we calculate the interval value
- The cursor to calculate empty points.
- And finally the result.
No comments:
Post a Comment