Welcome to MSDN Blogs Sign in | Join | Help

SQL Server 2008 R2 November CTP is available

Download page

What's New

For reporting services, enhancements include

  • shared datasets and cache refresh plans;
  • new data visualization report items;
  • enhancements to Reporting Services features that were included in previous releases of SQL Server 2008;
  • Business Intelligence Development Studio support for SQL Server 2008 reports and report server objects;
  • new Web Service endpoint that can support management operations of the report server in both native mode and SharePoint integrated mode.
Posted by levs | 0 Comments

Accessing Report Server from PowerShell

It is easy! Just create and compile SOAP proxy, and load it into PowerShell. Create instance, set credentials and URL.

wsdl.exe /out:rs2005.cs http://rshost/reportserver/reportservice2005.asmx
csc /t:library rs2005.cs
[Reflection.Assembly]::LoadFrom("rs2005.dll")
$rs = new-object ReportingService2005
$rs.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Now, $rs will talk to whatever server was set in step 1. Server URL can be changed easily:

$rs.Url = "http://anotherserver/reportserver/reportservice2005.asmx" 

Now we can call any SOAP API methods:

$rs.GetSystemProperties($null)

$rs.ListChildren("/",$false)

etc, etc.

Posted by levs | 0 Comments
Filed under:

Report Designer : editing reports produced by Report Bulder

Report Designer can be used to edit/preview reports produced by Report Builder.

Here is how to do it:

  1. In Report Builder, save report to file.
  2. Launch Visual Studio
  3. Create new Report Server Project
  4. Create new shared data source:
        Set connection string to
            Server=<report server URL>;datasource=<path to model which is used by report>
        For example
            Server=http://myserver/reportserver;datasource=/Models/Adventure Works
  5. Add existing report to project
  6. Switch to Data view (ignore error message)
  7. Click “…” to edit data set properties
  8. In Dataset dialog click “…” to edit data source properties
  9. Select shared data source created in step 4 using Reference dropdown
  10. Hit OK
  11. Hit OK
  12. Use "Project" -> "Add Existing Item to add report to project

 Now you can execute semantic query, preview and publish report

Do not forget, that report may not be opened in Report Builder after it is changed in Report Designer

Posted by levs | 0 Comments

New parameter properties

Two new  parameter properties are available in SQL 2005 Reporting Services:

.IsMultiValue and .Count

 

Posted by levs | 0 Comments

Report with image created by code

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <CodeModules>
    <CodeModule>System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</CodeModule>
  </CodeModules>
  <RightMargin>1in</RightMargin>
  <Body>
    <ReportItems>
      <Table Name="table1">
        <Height>0.52778in</Height>
        <Style />
        <Header>
          <TableRows>
            <TableRow>
              <Height>0.25in</Height>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox1">
                      <Style />
                      <ZIndex>5</ZIndex>
                      <rd:DefaultName>textbox1</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>Choice</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox2">
                      <Style>
                        <PaddingBottom>2pt</PaddingBottom>
                      </Style>
                      <ZIndex>4</ZIndex>
                      <rd:DefaultName>textbox2</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>Percentage</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox3">
                      <Style />
                      <ZIndex>3</ZIndex>
                      <rd:DefaultName>textbox3</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
              </TableCells>
            </TableRow>
          </TableRows>
        </Header>
        <Details>
          <TableRows>
            <TableRow>
              <Height>0.27778in</Height>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="Answer">
                      <Style />
                      <ZIndex>2</ZIndex>
                      <rd:DefaultName>Answer</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>=Fields!Answer.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="Percentage">
                      <Style>
                        <Format>F</Format>
                        <TextAlign>Left</TextAlign>
                      </Style>
                      <ZIndex>1</ZIndex>
                      <rd:DefaultName>Percentage</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>=Fields!Percentage.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Image Name="image1">
                      <MIMEType>image/bmp</MIMEType>
                      <Source>Database</Source>
                      <Style>
                        <BorderColor>
                          <Default>MediumTurquoise</Default>
                        </BorderColor>
                      </Style>
                      <Value>=Code.GenImage(100,8, Fields!Percentage.Value, iif( Fields!Answer.Value="Yes", System.Drawing.Color.Red, System.Drawing.Color.Blue), System.Drawing.Color.Aqua )</Value>
                      <Sizing>FitProportional</Sizing>
                    </Image>
                  </ReportItems>
                </TableCell>
              </TableCells>
            </TableRow>
          </TableRows>
        </Details>
        <DataSetName>DataSet1</DataSetName>
        <Width>4.875in</Width>
        <TableColumns>
          <TableColumn>
            <Width>1.75in</Width>
          </TableColumn>
          <TableColumn>
            <Width>1.125in</Width>
          </TableColumn>
          <TableColumn>
            <Width>2in</Width>
          </TableColumn>
        </TableColumns>
      </Table>
    </ReportItems>
    <Style />
    <Height>0.77778in</Height>
  </Body>
  <TopMargin>1in</TopMargin>
  <DataSources>
    <DataSource Name="northwind">
      <rd:DataSourceID>7459c22f-a4c2-4a3a-9c4c-341aa300a830</rd:DataSourceID>
      <ConnectionProperties>
        <DataProvider>SQL</DataProvider>
        <ConnectString>data source=.;initial catalog=northwind</ConnectString>
      </ConnectionProperties>
    </DataSource>
  </DataSources>
  <Code>    Public Shared Function GenImage(ByVal w As Integer, ByVal h As Integer, ByVal p As Double, byVal color1 as System.Drawing.Color, ByVal color2 as System.Drawing.Color ) As Byte()
        Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(w, h)
        Dim i, j As Integer
        For i = 0 To w - 1
            For j = 0 To h - 1
                If (i * 1.0 / w &lt; p / 100.0) Then
                    bmp.SetPixel(i, j, color1)
                Else
                    bmp.SetPixel(i, j, color2)
                End If
            Next
        Next

        Dim imageBytes() As Byte = Nothing

        Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream

        bmp.Save(memoryStream,System.Drawing.Imaging.ImageFormat.Bmp)
        bmp.Dispose()

        imageBytes = memoryStream.ToArray()
        memoryStream.Close()

        Return (imageBytes)

    End Function
</Code>
  <Width>5.01389in</Width>
  <DataSets>
    <DataSet Name="DataSet1">
      <Fields>
        <Field Name="Percentage">
          <DataField>Percentage</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Answer">
          <DataField>Answer</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
      <Query>
        <DataSourceName>northwind</DataSourceName>
        <CommandText>Select 73 as Percentage, 'Yes' as Answer
union all
Select 27 as Percentage, 'No' as Answer</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>
    </DataSet>
  </DataSets>
  <LeftMargin>1in</LeftMargin>
  <rd:SnapToGrid>true</rd:SnapToGrid>
  <rd:DrawGrid>true</rd:DrawGrid>
  <Description />
  <rd:ReportID>e85dcc26-799a-42ea-9139-9f4cb1172711</rd:ReportID>
  <BottomMargin>1in</BottomMargin>
  <Language>en-US</Language>
</Report>

Posted by levs | 1 Comments

Script for hiding report parameter

'=====================================================================
'  File:     HideParameter.rss
'
'  Summary:  Hides report parameter.
'      May be helpful if parameter has query based default value
'      Report Manager does not support this case 
'
'---------------------------------------------------------------------
' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
' PARTICULAR PURPOSE.
'=====================================================================*/
'
' Variables that are passed on the command line with the -v switch:
' itemPath - the path of the report 
' parameterName - name of the parameter
'
' Sample command line: 
' rs -i HideParameter.rss -s http://localhost/reportserver 
'     -v itemPath="/SampleReports/Report1" -v parameterName="myParameter"
Public Sub Main()
    If ((itemPath is Nothing) or (parameterName is Nothing) ) Then
        Console.WriteLine("Please provide required parameters")
    End If
    Dim Parameters() as ReportParameter
    ' Get report parameters
    Parameters = rs.GetReportParameters(itemPath, Nothing, false, Nothing, Nothing)
    Console.WriteLine("GetParameters successful")
    Dim i as Integer
    For i = 0 To Parameters.length - 1
        If (Parameters(i).Name = parameterName) Then 
           Parameters(i).PromptUser=true
           Parameters(i).PromptUserSpecified=true
           Parameters(i).Prompt=""
           rs.SetReportParameters(itemPath, Parameters)
           Console.WriteLine("SetParameters successful")
           return
        End If
    Next i
    Console.WriteLine("Parameter " & parameterName & " was not found")
End Sub 'Main
Posted by levs | 0 Comments

test

test
Posted by levs | 1 Comments
 
Page view tracker