We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to pass a parameter to report so it can be used in a dataset query for another parameter?

Hi there,

I have an issue with passing parameters through to a report using Blazor C#. Normally I can pass my parameters through fine, however, I have found when a second parameter is a Dataset that relies on the first parameter, its value is not being respected.

For instance, I have 2 parameters: UserID and Location. UserID has a default of 123 set on it, but should be set externally when the report is run. Location uses a dataset query to get its values, and the query it uses relies on UserID.

The query is:

SELECT L.ID AS Value
     , FL.Description AS Label
FROM Location L
INNER JOIN [dbo].[Get_F_Location](@UserID) FL ON L.ID = FL.ID
ORDER BY label


When I run the query locally with my correct UserID I get 100 records back. When I run it using c#, I only get 5 records back, because it is using the default UserID value of "123", not the value I have passed in.


I have tried setting the parameter in a few places to force it to work, and cannot figure it out.

In the client code (.razor.cs) before we call the BoldReports javascript


In the BoldReportsController.OnReportLoaded()

And in the BoldReportsController.OnInitReportOptions()


None of these work. 


However, if I set Hidden=false, I could see that the 789 was displayed in the UI, so the value is definitely getting set. So I think my problem is that I'm not setting it early enough to stop Location being calculated prior to me sending the parameter.


Do you know how I can resolve this? 


Thanks in advance.

Stu


1 Reply

AM Arumugasami Murugesan Syncfusion Team April 13, 2023 10:06 AM UTC

Hi Stuart Gray,


Thanks for contacting Bold Report support.


We have created a ticket for your query. Please check the ticket from the below site and follow further.

https://support.boldreports.com/support/tickets


Regards,

Arumugasami M


Loader.
Live Chat Icon For mobile
Up arrow icon