Home Subreports
New Blog Posts: Merging Reports - Part 1 and Part 2

Data Traversal

edited August 2006 in Subreports
Hello !

Can you give me a list of things that will affect data traversal I am having
a problem with data traversing properly, I get only one record
the following things were checked

1. The DBText objects DataPipeLine property is pointing to the proper
Datasource.
2. The Subreports object points to the proper DataPipeline component.
3. The DataPipeline component points to the proper Datasource.
4. There are two SubReports both have Section checked.

The problem is intermittent I setup a test report and found that for some
strange reason
I only get one record when I run the report even though everything is
pointing properly
here is the SQL Code but I also checked that and could not find a problem.


var
Day1,Day2 :tDate;
begin
with dmBooks.qryBooks, Reports do
begin
Day1 := DlgSelectExpenseReport.DateTimePicker1.date;
Day2 := DlgSelectExpenseReport.DateTimePicker2.date;
close;
sql.Clear;
sql.add('SELECT Category, Amount_Paid');
sql.add('from Vendors right join Payments on Payments.Account_Number =
Vendors.Account_Number');
sql.add('WHERE Date_Paid Between :Day1 and :Day2');
sql.add('Order by Category, Amount_Paid');
Params[0].AsDate := Day1;
Params[1].AsDate := Day2;
open;
with dmBooks.qryBooks1, Reports do
begin
Day1 := DlgSelectExpenseReport.DateTimePicker1.date;
Day2 := DlgSelectExpenseReport.DateTimePicker2.date;
close;
sql.Clear;
sql.add('SELECT Deposit_Date, Deposit_Amount');
sql.add('from Income');
sql.add('WHERE Deposit_Date Between :Day1 and :Day2');
sql.add('Order by Deposit_Date, Deposit_Amount');
Params[0].AsDate := Day1;
Params[1].AsDate := Day2;
open;
ppUnRegisterDevice(TppTextFileDevice);
ppUnRegisterDevice(TppReportTextFileDevice);
dmBooks.Reports.devicetype := dtscreen;
template.FileName := ExtractFilePath('Bookkeeper.exe') +
'Reports\P&LDetail.rtm';
template.LoadFromFile;
Print;
end;
end;


I have several reports and all of them work fine, except sometimes when
creating a report
I get only one record returned

Thanks
Richard

Comments

  • edited August 2006
    Hi Richard,

    Sorry for the delay.

    1. Try connecting a DBGrid to your dataset and be sure that once the SQL
    has changed, you are getting more than one record returned.

    2. Are you saving or loading templates? If so, you will need to be sure
    you assign the datapipeline after the template is loaded or you will loose
    this setting.

    3. Try placing a TppDesigner on your form and connecting it to your report,
    then load it using Designer.ShowModal. Then check that your subreport is
    properly connected to the correct datapipeline. Note that it is necessary
    for the subreport to be connected to a pipeline as well as a DBText. This
    is completely different from the main report's datapipeline property.

    If you have checked all the above and you are still getting the same
    behavior, please put together a small example that demonstrates this using
    the DBDEMOS database and send it to support@digital-metaphors.com in .zip
    format and I'll take a look at it for you.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.