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.

How to get the report parameter and passed it to web API


Hi!

I'm building an Angular report viewer and .Net Core as report service and the data source of the .rdl is Web API.

I need to get the value of the report parameter and pass it on to the data source (Web API).


Regards,
Dan Michael Jalimeo

15 Replies 1 reply marked as answer

MS Mahendran Shanmugam Syncfusion Team January 12, 2021 06:52 AM UTC

Hi Dan, 
  
Could you please get the parameter from report using our ReportHelper class GetParameterwithvalues. Please find the below help documentation for your reference to pass the parameter value from controller side. 

Regards, 
Mahendran S. 


Marked as answer

DM Dan Michael Jalimeo January 18, 2021 12:31 AM UTC

Hi Mahendran,

 Thank you for the reply and pointing out a solution for my issue but the problem in how can I apply those parameters to the Web API still a blur area. To give you some background, the way we can pass a parameter to Web API data source is through altering the connection string along with the parameters
on the OnReportLoaded event. But the problem the said event only run once, in short when you change a parameter on the client side and click the View Report button the event won't be called again, because of that you won't be abled to get the parameters and applied it to the connection string because the report is already loaded.

If I have something that I don't understand kindly correct me :)

I appreciate if you will give me a sample project that does my requirements.


Thanks,
Dan Michael Jalimeo


MS Mahendran Shanmugam Syncfusion Team January 18, 2021 12:22 PM UTC

Hi Dan, 

If we clicking the Viewreport button after changing the parameter then that call will not occurs for this case could you please hide the parameter button in toolbar as shown in below help documentation then please pass the parameter value in setModel event when clicking he external button as shown in  below code example.  
 
Angular client side code: 
<label> 
    StateProvinceCode: 
    <input type="text" #titleInput1 name="StateProvinceCode" id="StateProvinceCode" > 
</label> 
<label> 
    PostalCode: 
    <input type="text" #titleInput2 name="PostalCode" id="PostalCode" > 
</label> 
<button (click)="onClick(titleInput1.value,titleInput2.value)">Submit</button> 
 
<bold-reportviewer id="viewer"  
[reportServiceUrl] = "serviceUrl"  
[reportPath]="reportPath" 
[processingMode] = "Remote" 
style="width: 100%;height: 600px"> 
</bold-reportviewer> 

    onClick(StateProvinceCode:string,PostalCode:string) { 
      debugger; 
      this.parameters  = [{ 
          name: 'StateProvinceCode', 
          labels: [StateProvinceCode], 
          values: [StateProvinceCode], 
          nullable: false 
      }, 
      { 
        name: 'PostalCode', 
        labels: [PostalCode], 
        values: [PostalCode], 
        nullable: false 
    }]; 
      var reportviewer = $("#viewer").data('boldReportViewer'); 
      reportviewer.setModel({ "parameters": this.parameters }); 
  }; 


ServiceControllercode 
public void OnReportLoaded(ReportViewerOptions reportOption) 
        { 
            var parameters = ReportHelper.GetParametersWithValues(_jsonResult, this, _cache); 
            string connectionString = "http://localhost:58065/api/WebAPISecond/GetParamData"; 
            foreach (var parameter in parameters) 
            { 
                if (parameter.Name == "StateProvinceCode") 
                { 
                    connectionString = connectionString + "?StateProvinceCode=" + parameter.Values[0]; 
                } 
                else if (parameter.Name == "PostalCode") 
                { 
                    connectionString = connectionString + "&PostalCode=" + parameter.Values[0]; 
                } 
            } 
        } 

Regards. 
Mahendran S. 



DM Dan Michael Jalimeo January 19, 2021 12:27 AM UTC

Hi Mahendran, 

If I understood it correctly the sample code is suggesting that I will have to create external input textboxes then pass the value on submit and set those values in the report viewer's parameter, right? 

If this is the case this is what I'm currently doing now and it works fine, but I want to make use of the built-in components (e.g. textbox) of the bold reports. This will be beneficial to users and a non I.T. person because they can create a report of their own with the need to modify the Angular app.

Regards,
Dan Michael Jalimeo




MS Mahendran Shanmugam Syncfusion Team January 19, 2021 11:50 AM UTC

Hi Dan, 

If you are trying to change the connection string based on dynamic value when changing the parameter values then you can set the expression for WebAPI connection string at report level with parameter and it will changing the connection string based on dynamic value without changing your WebAPI datasource connection string in OnReportLoaded method in controller when clicking the ViewReport button in Report Viewer page. Could you please check the below help documentation for making the connection string based on parameter values for WebAPI datasources. 

For this case we don’t need to add the external button for using the setModel and it will working with report rendering itself. 
 
Regards, 
Mahendran S. 



DM Dan Michael Jalimeo January 19, 2021 02:16 PM UTC

Hi Mahendran,

I think this what I need but I'm not able to make it work, I'm not sure if you and your team are familiar with graphQL because this is the one connecting to. It works properly with bold reports but I'm having problem incorporating the parameter in the raw body query maybe your team have an idea about it.

{"query":"{  occupancyDetails ( startDate: \"2020-10-01\", endDate:\"2021-01-01\", allocation:\"Include all\",  locationTypeId:\"siteLevelId|ff56c65423a0e61186f206abee156f45\")  {  neighbourhoodId, neighbourhoodName, localDate, quantity } }"}


Those values between \"\" must be replaced with the bold reports' parameter. The && doesn't help me and maybe I have something that I don't understand.

Regards,
Dan Michael  Jalimeo




MS Mahendran Shanmugam Syncfusion Team January 20, 2021 01:44 PM UTC

Hi Dan, 

Thanks for your update. 

Could you please provide some more detailed explanation for getting issue at your end. And also is this possible to share API calls then could you please share and that will be helpful for reproducing the issue at our end. 

Regards, 
Mahendran S. 



DM Dan Michael Jalimeo January 21, 2021 01:22 AM UTC

Hi Mahendran, 

I created a sample app that will able your team to replicate the issue I'm encountering.

Basically my goal is to make the portion of my body raw query to be replaced by a parameter value.



I attached a sample GraphQL Web API and a report template, I also included an instruction on how to make it works.

I would like to thank you in advance and for helping with my issues.

Regards, 
Dan Michael Jalimeo 


Attachment: bookreport_f664c6f7.rar


MS Mahendran Shanmugam Syncfusion Team January 22, 2021 10:13 AM UTC

Hi Dan, 

Thanks for sharing the detailed information with sample. 

We were able to reproduce the mentioned issue and we have forwarded the issue to development team for finding the root cause for this issue. We will update you the more details for this issue by 25th January 2021. 

Regards, 
Mahendran S. 



MS Mahendran Shanmugam Syncfusion Team January 26, 2021 03:03 AM UTC

Hi Dan, 

Sorry for the delay. 

Still we are validating the root cause for this issue and we will update you the more details on 27th January 2021. 

Regards, 
Mahendran S. 



MS Mahendran Shanmugam Syncfusion Team January 29, 2021 09:38 AM UTC

Hi Dan, 

On our further analysis, we need to provide the expression support for this. We have logged the feature report for this. We will implement this and include this in our upcoming Bold Reports 3.1 release. It has been planned to release on mid of March 2021. 

Regards, 
Mahendran S. 



MR Manoranjan Rajendran Syncfusion Team March 16, 2021 10:06 AM UTC

Hi Dan,

Sorry for the delay. 
 
Unfortunately we were not able to make the Bold Reports v3.1 roll out as planned. Hence we have postponed the release. The release can be expected in the middle of April 2021. We will let you know once the Bold Reports v3.1 release is held. We request your patience until then.  
 
Regards, 
Manoranjan R 



MR Manoranjan Rajendran Syncfusion Team May 18, 2021 07:19 AM UTC

Hi Dan, 
 
Sorry for the delay, 
 
We were unable to include this feature in Bold Reports v3.1 Main release. We will include this feature in upcoming Bold Reports release v3.1 SP1. Which is schedule in middle of June 2021. We request your patience until then. 
 
Regards, 
Manoranjan R 



MR Manoranjan Rajendran Syncfusion Team May 24, 2021 12:29 PM UTC

Hi Dan, 

We have created the feedback for this issue. Please follow the further update from below feedback link, 


 Regards, 
Manoranjan R  



MR Manoranjan Rajendran Syncfusion Team June 28, 2021 05:07 AM UTC

Hi Dan,   
  
Sorry for the inconvenience.  
  
Due to some technical difficulties, we have not done this implementation. We are checking the possibilities to implement this feature. We will push these changes in any of our upcoming release. Please follow the further updates from below feedback link.  
  
  
Regards,   
Manoranjan R   


Loader.
Up arrow icon