Shared Data Source in Web Report Designer - ASP NET WEB API

1 Answer 21 Views
.NET Framework Report Designer - Web
Radu
Top achievements
Rank 1
Radu asked on 20 Mar 2024, 07:31 PM

Hi,
I am using ASP.NET WEB API ( not .Net Core ) and I try to integrate Web report designer into my ReactJs front-end
Telerik.Reporting version 17.1.23.718

I am using this Configuration

 ReportDesignerServiceConfiguration designerConfigurationInstance = new ReportDesignerServiceConfiguration
 {
     DefinitionStorage = new FileDefinitionStorage(reportsPath),
     SettingsStorage = fs,

     SharedDataSourceStorage = new FileSharedDataSourceStorage(reportsSharedDSPath),
 };

 

It all works when I try to create a Shared Data Source and for the first time I want to bind it to a Wizard Table but when I go to Preview it shows me an error

An error has occurred while processing Table 'table1': Cannot instantiate the referenced DataSource. Value cannot be null.Parameter name: The path to the SharedDataSource asset was null or empty.


And If I save the same report and try to reopen, it doesn't recognize the shared data source and gives me this error:

Unable to retrieve the referenced Shared Data Source for 'sDS_Test1'.

But the shared data source exists and it is in the same place, if I try to manually add it again it will work and recognize it, but again the preview won't work.

Perhaps I have to use a CustomSharedDataSourceResolver ?

CustomSharedDataSourceResolver : Data.ISharedDataSourceResolver

If yes how do I integrate it in my ASP NET project cause I don't have the appsettings.json file to add the section:

I have to use Web.config but I don't understand how to integrate it, I cannot find any documentation for ASP.NET WEB API.

"telerikReporting": {
  "processing": {
    "resourceResolver": {
      // The element below represents an implementation of a Resource resolver that uses a path provider:
      //"provider": "path",
      //"parameters": [
      //  {
      //    "name": "directory",
      //    "value": "c:\\CommonResources\\"
      //  }
      //],

      // The element below represents an implementation of a Resource resolver that uses a custom type provider:
      "provider": "custom",
      "parameters": [
        {
          "name": "typeName",
          "value": "SqlDefinitionStorageExample.CustomResourceResolver, SqlDefinitionStorageExample"
        }
      ]
    },
    "sharedDataSourceResolver": {
      // The element below represents an implementation of a SharedDataSource resolver that uses a path provider:
      //"provider": "path",
      //"parameters": [
      //  {
      //    "name": "directory",
      //    "value": "c:\\CommonSharedDataSources\\"
      //  }
      //],

      // The element below represents an implementation of a SharedDataSource resolver that uses a custom type provider:
      "provider": "custom",
      "parameters": [
        {
          "name": "typename",
          "value": "SqlDefinitionStorageExample.CustomSharedDataSourceResolver, SqlDefinitionStorageExample"
        }
      ]
    }
  }
}


Please help me,
Thanks

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 25 Mar 2024, 01:51 PM

Hello Radu,

Thank you for the shared code and the additional information!

I suggest first making sure that the Path and Name properties of the SharedDataSource component are populated with the correct values:

The correct path will depend on the reportsPath and reportsSharedDSPath variables used for creating the definition and shared data source storages.

With that being said, since the components work as expected design time, before the preview, I suspect that the issue is with how the path is resolved when previewing the report. By default, at runtime, the .sdsx files are resolved with a path relative to the report definition in which they are utilized so when the report is previewed, the path to the SDSX file will likely be resolved relative to the reportsPath.

The solution here is to set the value of the reportsSharedDSPath variable as the base directory for the default SharedDataSourceResolver implementation. In an XML-based configuration file such as Web.config, this can be done like:

<Telerik.Reporting>
    <processing>
          <sharedResourceResolver provider="path">
            <parameters>
                <parameter name="directory" value="c:\\CommonSharedDataSourceDirectory\\" />
            </parameters>
        </sharedResourceResolver>
    </processing>
</Telerik.Reporting>

For more details on how to configure the reports processing element, you may refer to the Configuring the processing Element - Telerik Reporting article.

In case further assistance is needed, please send a copy of the project or minimal demo where the issue is reproducible so that I can debug it locally.

I hope setting the correct path in the configuration will resolve the problem.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
.NET Framework Report Designer - Web
Asked by
Radu
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or