Main Report and Subreport solution RRS feed

  • Question

  • Hi All :

    I'm learning the report and we have 2 datasets which need add into report

    The structure of main dataset :

    StudentID , StudentName, Class, Gender

    Then we have another dataset (but this dataset ) is not related with main dataset , The structure is

    QuestionID, QuestionMsg

    Sample Data :

    StduentID StduentName Class Gender
    1 Peter 1A Male
    2 Katie 2A Female
    3 Jack 3A Male

    The sub report dataset data

    QuestionID QuestionMsg
    1 What is your name ?
    2 Where do you live ?
    3 What is your favorite drink ?

    And I want the report is :

    Student ID : 1

    Student Name : Peter

    Class : 1A

    Question :

    1. What is your name ?

    2. Where do you live ?

    3. What is your favorite drink ?

    ---- Page Break ------

    Student ID : 2

    Student Name : Katie

    Class : 2A

    Question :

    1. What is your name ?

    2. Where do you live ?

    3. What is your favorite drink ?

    ---- Page Break ------

    with 3 pages 

    I want to put this two datasets in the same Tablix, but it is not work, I have found  only 2 solutions for this case.

    Solutions 1 : Create sub report and bind the datasets in this report. And then the main report add the sub report there.

    Problem : It seem this solution require report server, and I cannot add sub report in local directory  (e.g. c:\subreport.rdl) under report builder. 

    Solutions 2 :

    It can add the table in Tablix, the cell expression using Lookup function or vlookup function

    Problem : as above 2 datasets have not relationship, cannot join with any key. Any other expression code which can do ?

    Thank you for your help.

    • Edited by Michael TC Thursday, August 22, 2019 5:25 AM
    Thursday, August 22, 2019 5:21 AM

All replies

  • Hi Michal TC,

    Based on your description, I have two suggestions.

    1. One solution would be to use SSDT2017 to develop this report, in ssdt you could insert directly the report from same project as subreport, does not need report server.

    2. Second solution is that, we can make two datasets to a big flag dataset.

    Using query such as 

    SELECT *,'What is your name ?' as QuestionMsg1,'Where do you live ?' as QuestionMsg2,'What is your favorite drink ?' as QuestionMsg3
    FROM yourTabal1

    This would be far more easy than using lookup and so on.

    Hope this helps.


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 23, 2019 5:44 AM