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

Only print Notes if there are any

edited December 2001 in General
I am doing a report on a Product table.
Each product can have Notes relating to it.
I want to list all the Products and after that i want to have a heading
'Product Notes' and this is where i would put all the Notes for each
product.
My problem is this...
I don't want the Heading 'Product Notes' to come up if none of the Products
have any notes.

Is this possible.
It needs to be done without going into Delphi at design time.

Thanks
John

Comments

  • edited December 2001
    Is there a detail datapipeline and a detail subreport for the products? If
    so, then place the header in a group inside the subreport. Create the group
    on the linking field, so that it won't break. The end result is that you
    will get one group header for the 'Product Notes' heading. It won't print
    if there are no detail records. Also set the subreport's NoDataBehaviors to
    BlankPage.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    Sorry Jim but i don't quite follow you.
    I'll try and explain my exact scenario for you.
    The report is a master/detail quotation report where the details are the
    items in the report.
    Both have a separate pipeline.
    On the main Page all i have is the title/quote number and i have dropped on
    a SubReport which i assigned the detail pipeline.
    On the sub report, i added a group with the quotation detail headers( these
    are just labels) so that i would get these headers printed on all pages(not
    just the first one).
    In the SubReport detail section i added the detail fields i want printed and
    assigned their dataset fields.
    In the sub report summary section i added a few calculated fields so i could
    show the totals for all the quotation details.
    This report works just great, except that i need any notes that are created
    for a quotation detail printed out after all the quotation details have been
    printed.
    I can't put them in the sub report detail section as i need them all
    together at the end of the report just before i show the calculated fields.
    As i say, i do have a group already, but i couldn't follow your
    instructions.
    I have tried adding another SubReport , and trying to use regions but i am
    not getting very far.
    Any other help would be greatly appreciated.
    Thanks
    John


  • edited December 2001
    OK, in the summary band of the detail subreport, add another subreport.
    Connect it to the same detail data pipeline also. It will traverse all of
    the detail records, and show the notes fieldvalues from the detail records.

    Place your dbCalc controls in the summary band of the main subreport in a
    region. Set the region to ShiftRelativeTo the subreport which you've just
    added to the summary band. Now the notes will print in the subreport of the
    summary band and the calcs will print in the region just below the notes.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    Right, i think we're nearly there now...
    The only thing i need to do now is to NOT print any Notes if there are not
    any for each record.

    I looked at your first reply, and tried to do something similar but failed.
    Also i couldn't work out how to set the subreport's NoDataBehaviors to
    BlankPage,(i do not have access to the source code at this time),
    as i thought this could have something to do with solving
    my problem.

    Continued thanks
    John




    records.
    the
    am
    products?
    you
  • edited December 2001
    Here is an example of what I did to approach your problem. I used a
    customer-orders report. In the summary band on the orders subreport, I
    placed another orders subreport which printed the PaymentMethod field from
    the detail dataset. This is just to emulate your Notes field values.
    Anyway, I hid this subreport when all detail fiedl values for where
    'Credit.' You should be able to take this approach and hide the subreport
    when all of the Notes field values are null or empty. This is accomplished
    by checking the record values as the detail band prints for the main detail
    subreport and setting a boolean flag to determine if a subreport should be
    printed in the summary band for your Notes.

    http://www.digital-metaphors.com/tips/HideSummaryLookupSubreportOnDetailData
    set.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    So are you saying that this type of report (where records only print if
    there is data)
    can't be done by an End User then ?

  • edited December 2001
    End users could do it. However, they'll need to write code in RAP, using
    the approach in the demo.

    A better approach is to create another dataset especially for the notes
    records. All you need is the linking field, the notes field, and a calc
    field which will only bring back record that have notes. If there are no
    notes records, tehn there won't be any detail records and NoDataBehaviors
    (should be set to BlankPage) on the subreport will cause it to not show at
    all. I'll email you a report template that shows this. I've changed the zip
    file so that you don't have to use calculations. It's just a rtm you can
    load.
    http://www.digital-metaphors.com/tips/HideSummaryNotes.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited December 2001
    Ok. Thanks for all your help on this Jim

    John
This discussion has been closed.