This is a migrated thread and some comments may be shown as answers.

Generate details section using one of several parameters for a stored procedure

2 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 02 Jul 2019, 07:30 PM

Here is what I'm trying to do.

 

I have a stored procedure that takes five parameters: Start, End, Name, Type1, and Type2. I need to generate this report using (Start, End, Type1, Type2) for each selected Name, which is a multivalue parameter on the top-level report. e.g., each detail section or subreport for Mark, Amy, Nick, etc should use the same values for the other parameters.

How do I go about doing this?

2 Answers, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 03 Jul 2019, 09:00 PM

Alright, so I came up with a solution for this, but I'm not sure if there's a faster / better / built-in way to do the same thing I'm doing.

I created an inner Salesman class that just has Name and Id fields. I set the top-level report's DataSource to null to make the NeedsDataSource event fire. Then, I grabbed Parameters["Salesmen"].Label and Parameters["Salesmen"].Value and put them into pairs in their respective Name and Id fields (so that labels[i] and values[i] formed a coherent Salesman object), then added those objects to an ObservableCollection<Salesman>. I set the report's DataSource to the ObservableCollection, and set the subreport's DataSource to ReportItem.DataObject.

 

THEN, I changed the parameter on my storedprocedure to take @salesman as ReportItem.DataObject.Id. All other fields from the storedprocedure can just take Parameter.$PARAM_NAME.Value, since they are (or seem to be?) inherited directly from the main report.

0
Todor
Telerik team
answered on 05 Jul 2019, 12:35 PM
Hello Andrew,

You may test to use MultiValue Report Parameter in a SQL query and after fetching all the relevant data to group the report by Fields.Name. This will generate one group for each Name, and will render a separate detail section for each group, which is how I understood the requirement.

You may find relevant also the following articles :
 - Using Parameters with the SqlDataSource component
 - Using Multivalue Parameters
 - How to: Add groups to Report
 - Group Explorer

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Todor
Telerik team
Share this question
or