none
SSRS - Related datasets

    Question

  • Hi,

    I have two Datasets: Dataset1 and Dataset2.

    Dataset1 retrieves only one record (Fields are - For example -: ID, Name)

    Dataset2 need to retrieves some records based on the ID field of the first Dataset.

    Note that both Datasets fields are used on Placeolder expresions (On TextBox), I mean, not within table, charts...

    Is that possible? If so how?

    Regards,

    Bader

    Wednesday, August 22, 2012 2:15 PM

Answers

All replies

  • create a parameter

    name para_YourTable_Id

    type integer

    Default value -> Dataset1.Id

    Then in dataset 2, change your query for

    select whatEverField

    From WhatEverTable

    where Id = @para_YourTable_Id

    Alex

    Wednesday, August 22, 2012 2:46 PM
  • Hi Bader,

    In your scenario, Alex’s suggestion is exactly right. Add a filter to dataset2 can also give you the same result. Add a filter into dataset2 like below:
    Expression: ID
    Operator:  =
    Value: @para_YourTable_Id

    Besides, you can use lookup function in the textbox to do it. The expression looks like below:
    =lookup(fields!ID.Value, fields!ID.Value, fields!ColumnName.Value, ”DataSet2”)
    For more information about lookup function, please see:
    http://msdn.microsoft.com/en-us/library/ee210531.aspx

    If you have any questions, please feel free to ask.

    Regards,
    Charlie Liao

    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedbackhere.

    Friday, August 24, 2012 8:13 AM
    Moderator
  • Hi nadeem,

    You can do it,

    Create a parameter like @paramID and its value should be Dataset1.ID.value

    then filter your Dataset2 with Dset2.ID=@paramID

    Hope this will solve your problem...

    if i misunderstood something please feel free to ask me again....

    Mark as answer if i am correct..

    thanks


    shahsank

    Tuesday, July 30, 2013 4:34 AM