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

3 posts, 0 answers
  1. Andrew
    Andrew avatar
    3 posts
    Member since:
    Jul 2019

    Posted 02 Jul Link to this post

    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. Andrew
    Andrew avatar
    3 posts
    Member since:
    Jul 2019

    Posted 03 Jul in reply to Andrew Link to this post

    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.

  3. Todor
    Admin
    Todor avatar
    384 posts

    Posted 05 Jul Link to this post

    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
Back to Top