If you became a customer of the Syncfusion� Reporting Platform or the Report Viewer, Report Designer, or Report Writer components before October 2019 and have questions related to those products, you can request support through our forum system. However, please note that this support system is only for existing customers who are still using the Syncfusion� Reporting Platform or its components and not for new customers looking for reporting products from Syncfusion�.

For new customers or those with general reporting questions, we recommend contacting our support team at https://support.boldreports.com/, which is a separate brand created by Syncfusion� for its reporting solutions. Our team will be happy to assist you with any questions you may have.

Thank you for choosing Syncfusion� for your reporting needs.

The data source ‘X’ has both or neither of the following: DataSourceReference and ConnectionProperties. The data source must have exactly one of these elements.

Hello,

Im currently working on blazor application that uses BoldReports. I have implemented dedicated WebAPI that returns the simple json with list of Employee Names. I use Bearer token and everyting works as expected as long as I work in the standalone designer. (Even repoert preview looks like expected - data is loaded.) After I deploy my report I have a message that 
"The data source ‘Employees’ has both or neither of the following: DataSourceReference and ConnectionProperties. The data source must have exactly one of these elements."
For me it seems that datasource is empty and was never loaded, I can see it well when I open report file rld in vs code:
  <DataSources>
    <DataSource Name="Employees">
      <ConnectionProperties>
        <DataProvider>WebAPIDataProvider>
        <ConnectString>{"MethodType":"Get","Headers":[{"Key":"Authorization","Value":"= Parameters!Token.Value"}],"SecurityType":"None","URL":"https://localhost:5001/api/EmployeesAPI/GetEmployeeNames","DataFormat":"JSON"}ConnectString>
        <rd:CustomProperties>
          <rd:CustomProperty>
            <rd:Name>DefaultValuesrd:Name>
            <rd:Value>{"url":"","rawdata":"","parameters":[],"headers":[{"Key":"Authorization","Value":"Bearer blablablalbalbalbalba"}]}rd:Value>
          rd:CustomProperty>
        rd:CustomProperties>
      ConnectionProperties>
    DataSource>
  DataSources>
  <DataSets>
    <DataSet Name="EmployeeNames">
      <Fields>
        <Field Name="name">
          <DataField>nameDataField>
          <rd:TypeName>System.Stringrd:TypeName>
        Field>
      Fields>
      <Query>
        <DataSourceName>EmployeesDataSourceName>
        <CommandType>TextCommandType>
        <CommandText>{"Name":"GetEmployeeNames","Columns":[]}CommandText>
        <QueryDesignerState xmlns="http://schemas.microsoft.com/ReportingServices/QueryDefinition/Relational">
          <Tables>
            <Table Name="GetEmployeeNames" Schema="">
              <Columns>
                <Column Name="name" IsDuplicate="False" IsSelected="True" />
              Columns>
              <SchemaLevels>
                <SchemaInfo Name="GetEmployeeNames" SchemaType="Table" />
              SchemaLevels>
            Table>
          Tables>
        QueryDesignerState>
      Query>
    DataSet>
  DataSets>



My OnInitReportOptions method looks like this:
public void OnInitReportOptions(BoldReports.Web.ReportViewer.ReportViewerOptions reportOption)
{
string basePath = _hostingEnvironment.WebRootPath;
var reportStream = new FileStream(basePath + @"\Reports\" + reportOption.ReportModel.ReportPath + ".rdl", FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
//reportOption.ReportModel.DataSources //todo it looks like DataSources are not loaded from file :(
}

Is that problem known? Do you have any solution or workaround?
I have already tried to load DataSource manually with no luck:

XmlDocument doc = new XmlDocument();
doc.Load(basePath + @"\Reports\" + reportOption.ReportModel.ReportPath + ".rdl");


XmlNodeList elemList = doc.GetElementsByTagName("DataSources");

foreach (XmlNode elem in elemList)
{
reportOption.ReportModel.DataSources.Add(new ReportDataSource(elem.Name, elem.InnerText));
}

3 Replies 1 reply marked as answer

MS Muthuramana Sankaranarayanan Syncfusion Team February 25, 2021 04:53 AM UTC

Hi Kamil, 

We checked your reported issue with the shared details. The WebAPI datasource will not be present as inbuilt for the standalone Report Viewer application due to which you should have faced this issue. In order to preview reports in standalone report viewer having WebAPI datasource, you need to configure the WebAPI datasource extension with your application. We suggest you to refer the below documentation regarding configuring the WebAPI datasource extension with your application. 


Regards, 
Muthu Ramana S 


Marked as answer

KM Kamil Miszczak February 25, 2021 10:16 PM UTC

Thank you for your help. Works great :)


MS Muthuramana Sankaranarayanan Syncfusion Team February 26, 2021 05:02 AM UTC

Hi Kamil, 

Thanks for your update. 

We are glad to hear that your reported issue is resolved. 

Regards, 
Muthu Ramana S 


Loader.
Up arrow icon