Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Reporting Services and Set Shared Data Source

Back to Forum: Tech Off
  • User profile image
    darklotus

    I am building an application to take a folder full of report files and adding them to sql reporting services 2005 via the web service. I can upload the reports correctly but i run into a problem because the datasource is invalid. I can go into the report manager and change them, but i would rather programatically set the data source to a shared datasurce that already exists on the server. How can i set the data source to a shared datasource when i upload the report through the web service?

    Thanks!

  • User profile image
    Keylog

    Hi darklotus,
    i' m doing the same and getting the same problem; did you solve it? In case, could you let me know how?

    Thanks in advance!
    Marco

  • User profile image
    figuerres

    Been a long time since I looked at the services details but I am thinking of two things to try ....

    1)  ask the server for the name/ names of shared data sources via the RS WS calls.
    then give the user a GUI to pick the right name.
    then use report class bits to update the report to have the ds name and then upload it.

    that seems like the "right way" in general.

    2) the report file is XML, the DS name is just a value in there some where.....  use linq to xml or the older xml classes to update that and send it over.

    #3 is what I do:
    in my report project I have a ds that has a local server connection but the same name as the prodcution site.
    so when I upload a report it already has the right name in it.

  • User profile image
    Keylog

    figuerres said:
    Been a long time since I looked at the services details but I am thinking of two things to try ....

    1)  ask the server for the name/ names of shared data sources via the RS WS calls.
    then give the user a GUI to pick the right name.
    then use report class bits to update the report to have the ds name and then upload it.

    that seems like the "right way" in general.

    2) the report file is XML, the DS name is just a value in there some where.....  use linq to xml or the older xml classes to update that and send it over.

    #3 is what I do:
    in my report project I have a ds that has a local server connection but the same name as the prodcution site.
    so when I upload a report it already has the right name in it.
    Hi figuerres,
    thanks for the help; however I did it, I've pasted the code just in case it could be useful.

    Dim DscItem As ProdCatalogListViewItem
                    For Each DscItem In ListView2.SelectedItems
                        If DscItem.Type = RSTarget.ItemTypeEnum.DataSource Then
                            Dim DscPathName As String = DscItem.Path
                            Dim RetRepPathDscName As New ArrayList()

                            'The function returns the target path where create report and datasource target name
                            RetRepPathDscName = RetRepPathTgt(RepName, DscPathName)

                           
                            Dim RetPathName As String = RetRepPathDscName(0)
                            Dim RetDscName As String = RetRepPathDscName(1)

                            'Report publishing
                            Try
                                'Creazione del report
                                RSDest.CreateReport(RepItem.Text, RetPathName, chkPubOvrWrt.Checked, Definition, Nothing)

                            Catch ex As SoapException
                                Alert = True
                                Dim ErrMsg As String = "Err: report " & RepItem.Text & ControlChars.Lf
                                ErrMsg = ErrMsg & ex.Detail.InnerXml.ToString() & ControlChars.Lf

                                Dim Ret As Boolean = SaveLogFile(ErrMsg, LogPath)

                            End Try

                            'get definition of target datasource and the datasource properties in current report

                            Dim DscDefinition As RSProduzione.DataSourceDefinition = Nothing
                            DscDefinition = RSDest.GetDataSourceContents(DscPathName)
                            Dim DsReference As New RSProduzione.DataSourceReference()
                            DsReference.Reference = DscPathName
                            'Dim DataSources(0) As RSProduzione.DataSource
                            Dim DataSources() As RSProduzione.DataSource = RSDest.GetItemDataSources(RetPathName & "/" & RepItem.Text)
                            Dim ds As New RSProduzione.DataSource()
                            ds = DataSources(0)

                            'ds.Item = CType(DsReference, RSProduzione.DataSourceDefinitionOrReference)
                            ds.Item = CType(DsReference, RSProduzione.DataSourceReference)
                            'ds.Name = RetDscName
                            DataSources(0) = ds

                            'Set new datasource   
                            Try
                               
                                RSDest.SetItemDataSources(RetPathName & "/" & RepItem.Text, DataSources)

                            Catch ex As SoapException
                                'MsgBox(ex.Detail.InnerXml, MsgBoxStyle.Critical, "Errore")
                                'Console.WriteLine(ex.Detail.InnerXml.ToString())
                                Alert = True
                                Dim ErrMsg As String = "Err: report " & RepItem.Text & ControlChars.Lf
                                ErrMsg = ErrMsg & ex.Detail.InnerXml.ToString() & ControlChars.Lf

                                Dim Ret As Boolean = SaveLogFile(ErrMsg, LogPath)

                                'Exit Sub
                            End Try

  • User profile image
    Keylog

    Keylog said:
    figuerres said:
    *snip*
    Hi figuerres,
    thanks for the help; however I did it, I've pasted the code just in case it could be useful.

    Dim DscItem As ProdCatalogListViewItem
                    For Each DscItem In ListView2.SelectedItems
                        If DscItem.Type = RSTarget.ItemTypeEnum.DataSource Then
                            Dim DscPathName As String = DscItem.Path
                            Dim RetRepPathDscName As New ArrayList()

                            'The function returns the target path where create report and datasource target name
                            RetRepPathDscName = RetRepPathTgt(RepName, DscPathName)

                           
                            Dim RetPathName As String = RetRepPathDscName(0)
                            Dim RetDscName As String = RetRepPathDscName(1)

                            'Report publishing
                            Try
                                'Creazione del report
                                RSDest.CreateReport(RepItem.Text, RetPathName, chkPubOvrWrt.Checked, Definition, Nothing)

                            Catch ex As SoapException
                                Alert = True
                                Dim ErrMsg As String = "Err: report " & RepItem.Text & ControlChars.Lf
                                ErrMsg = ErrMsg & ex.Detail.InnerXml.ToString() & ControlChars.Lf

                                Dim Ret As Boolean = SaveLogFile(ErrMsg, LogPath)

                            End Try

                            'get definition of target datasource and the datasource properties in current report

                            Dim DscDefinition As RSProduzione.DataSourceDefinition = Nothing
                            DscDefinition = RSDest.GetDataSourceContents(DscPathName)
                            Dim DsReference As New RSProduzione.DataSourceReference()
                            DsReference.Reference = DscPathName
                            'Dim DataSources(0) As RSProduzione.DataSource
                            Dim DataSources() As RSProduzione.DataSource = RSDest.GetItemDataSources(RetPathName & "/" & RepItem.Text)
                            Dim ds As New RSProduzione.DataSource()
                            ds = DataSources(0)

                            'ds.Item = CType(DsReference, RSProduzione.DataSourceDefinitionOrReference)
                            ds.Item = CType(DsReference, RSProduzione.DataSourceReference)
                            'ds.Name = RetDscName
                            DataSources(0) = ds

                            'Set new datasource   
                            Try
                               
                                RSDest.SetItemDataSources(RetPathName & "/" & RepItem.Text, DataSources)

                            Catch ex As SoapException
                                'MsgBox(ex.Detail.InnerXml, MsgBoxStyle.Critical, "Errore")
                                'Console.WriteLine(ex.Detail.InnerXml.ToString())
                                Alert = True
                                Dim ErrMsg As String = "Err: report " & RepItem.Text & ControlChars.Lf
                                ErrMsg = ErrMsg & ex.Detail.InnerXml.ToString() & ControlChars.Lf

                                Dim Ret As Boolean = SaveLogFile(ErrMsg, LogPath)

                                'Exit Sub
                            End Try
    Hi, a little mistake in prior pasted code: RsProduzione =  RsTarget
    sorry...

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.