Thursday, 19 July 2012

SSRS: Colour Coding Charts to Match Excel 2007

Charts in SSRS can be configured to use custom colour palettes. I quite liked the colour scheme used by default in Excel 2007 charts, so I used an eyedropper tool to work out the colour codes it used. Here are the first 16:
            #40699C
            #9E413E
            #7F9A48
            #695185
            #3C8DA3
            #CC7B38
            #4F81BD
            #C0504D
            #9BBB59
            #8064A2
            #4BACC6
            #F79646
            #AABAD7
            #D9AAA9
            #C6D6AC
            #BAB0C9
 
You can replace a chart's palette in BIDS by viewing the XML code of your RDL, searching for the <Palette> tag and replacing it with the following code:
            <Palette>Custom</Palette>
            <ChartCustomPaletteColors>
                <ChartCustomPaletteColor>#40699c</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#9e413e</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#7f9a48</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#695185</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#3c8da3</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#cc7b38</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#4f81bd</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#c0504d</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#9bbb59</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#8064a2</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#4bacc6</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#f79646</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#aabad7</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#d9aaa9</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#c6d6ac</ChartCustomPaletteColor>
                <ChartCustomPaletteColor>#bab0c9</ChartCustomPaletteColor>
            </ChartCustomPaletteColors>

Friday, 10 February 2012

SSRS: Stored Procedures Running Slowly in SSRS

Occasionally, a stored procedure that runs quickly when executed directly can run slowly when used in a RDL dataset. One of the reasons for this can be due to the way SSRS passes query parameters to SQL Server. Unexpected parameter types can cause the cached execution plan to perform poorly.
A solution to this is to force the stored procedure to recompile the execution plan each time it is run, by adding the following query hint to the end of your procedure:
option (recompile)
It's worth pointing out that this will slightly reduce the overall speed of the procedure. So, if your procedure is called very regularly, you might want to avoid using this hint.