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

Controlling Subreport output in a text file.

edited June 2010 in General
Hi

I am trying to create a report that will output data in XML format.

I can create a simple output from one set of data, but I would now like to
put two unrelated sets of data in the XML. The output I'm trying to create
will be something like:

<?xml version="1.0! encoding="UTF-8"?>

DS1FieldData
...


DS2FieldData
...



To try and achive this, I've put the first line in the main report header
and the last line in the main report summary band. I've then created two
subreports in the detail band. I've tried putting '' in the sub report header or in a group header (where I
made sure there will only be one group) and ' line in the sub
report summary or group footer. This looks fine on screen, but I find that
the output is as follows:

<?xml version="1.0! encoding="UTF-8"?>


DS1FieldDataDS2FieldData
...



It appears that the output of both sub reports are being mixed together.

I've tried using the 'Shift Relative To' option but this does not make any
difference.

Is there a way around this problem?

Using Delphi 7 and Report Builder 11.04

Mike

Comments

  • edited June 2010
    Hi Mike,

    Take a look at the TppTextFileDevice located in the ppFilDev.pas file.

    Inside the SavePageToFile routine, a TStringList is created containing all
    the drawcommands located on the page. The routine later makes a call to
    sort the string list based on the DrawCommand.Order property (which takes
    the subreport into account for RB 11).

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2010
    Nico

    I can see why the data is not being sorted correctly. Adding two sub
    reports to the detail band of the main report gives both sub reports a
    ReportSaveNo of 1.

    The line that does this is in ppCtrls

    if Band.Report.Parent is TppSubReport then
    lDrawText.ReportSaveNo := TppSubreport(Band.Report.Parent).Count + 1
    else
    lDrawText.ReportSaveNo := 0;

    Count always returns 0

    I don't fully understand what the Count property on a sub report does. I
    see it is a read only property and it initalised to 0 on create of a sub
    report. I can't make out how this value will ever be different for
    different sub reports as it does not seem to be passed back to the main
    report at any point, and being read only the main report could not change
    the value for the second sub report anyway.

    Have I misunderstood something?

    Mike


  • edited June 2010
    Hi Mike,

    This issue was fixed for a later version of ReportBuilder. Upgrading to RB
    11.08 should solve the problem.

    Contact info@digital-metaphors.com with your serial number and purchasing
    email address for upgrade instructions.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2010
    Thanks Nico

    Mike
This discussion has been closed.