Home Subreports

Using the same SQL for different subreports

edited October 2002 in Subreports
Reference the previous message; I have now found out how to assign the
datafield property but I now have another problem. I have ten sub-reports
each going to display a student's results for a set of exercises say. Each
sub-report and its associated ppDBText component accesses the same TQuery
therefore they access the same datapipeline and same datafield. How can I,
at runtime, display each individual student's results in their relevant
sub-report using the same TQuery . The SQL statement returns a student's
results passing in the StudentID as a parameter.

Comments

  • edited October 2002
    If the current record contains all the information you need, then create
    more dbTexts to display the data in the detail band. Otherwise, if you have
    lookup data in the same table, then you should create a new query which will
    get those records in a master detail relationship. See the main report
    demos for examples on creating master detail reports. There is also some
    helpful information on master detail reporting the Developer'Guide.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    What I am trying to do at runtime is looping through the TQuery.SQL
    statement for each student and putting the results in that student's
    subreport. So Student A's reusults go in subreport1, student B's in
    subreport 2, etc.
  • edited October 2002
    Don't traverse the dataset and the Report is generating. This may
    cause undesirable results. Use multiple datapipelines to return different
    datasets and let RB print those records for you automaticlly. Otherwise, use
    one dataset and don't use subreports, just put all the controls in one band.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.