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

Groups

edited April 2002 in General
Hallo.. I've this problem:

I've to Enable-Disable a GroupBand at runtime..
How can I do?

Raf

Comments

  • edited April 2002
    You can disable or reanable the group be setting it's report property, ie.

    ppReport.Group[0].Report:= nil;

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited April 2002
    If I remove the group by setting the report property it's all OK but..
    if i reanable the group when i call the print method of the report
    it raise an exception...how can I do?

    Raf

    "Alexander Kramnik (Digital Metaphors)" ha
  • edited April 2002
    What exception are you receiving? Make sure you store the reference to the
    group object property because once you set the group's Parent property to
    nil you can't access it though the Report.Group property anymore.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited April 2002
    I receive a EPrintError exception...

    I Disable my Group by setting the Report property of the Group:

    MyReport.Groups[0].Report:=nil;

    ..but if I reanable the group:

    MyGroup.Report:=MyReport;

    Raf.


    "Alexander Kramnik (Digital Metaphors)" ha
  • edited April 2002
    I Disable my Group by setting the Report property of the Group:

    MyReport.Groups[0].Report:=nil;

    I print the report..It's all OK....

    I reanable the group:

    MyGroup.Report:=MyReport;

    I print the report..It's all OK....

    I Re-Disable my Group...

    MyReport.Groups[0].Report:=nil;

    I print the report and it raise an EPrintError

    Raf

  • edited April 2002
    There is a group object on the form, ppGroup1 for example. Instead of trying
    to nil its report property, you should set the group header and footer bands
    to visible = False and set the group StartNewPage property to False.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited April 2002
    ..it's the same ... I disable the group and print...all ok...
    I reanable the group and print..all ok...
    I re-disable the group and print ... it raise an exception EPrintError.

    ppgroup1.HeaderBand:=nil;
    ppgroup1.FooterBand:=nil;
    ppreport1.Print; //all ok
    ....
    ppgroup1.HeaderBand:=myGroupHeader;
    ppgroup1.FooterBand:=myGroupFooter;
    ppreport1.Print; // all ok
    ....
    ppgroup1.HeaderBand:=nil;
    ppgroup1.FooterBand:=nil;
    ppreport1.Print; // EPrintError

    ...and this way is wrong because when I disable the group
    I've to print from different query that haven't the field
    ppGroup1.FieldName..
    so.. if I solve the error..EPrintError ...I have another error... Field not
    Found..

    Raf

    PS. Excuse me for my bad english.


  • edited April 2002
    Don't nil out the bands or groups, just set their visible properties. The
    bands won't generate if they aren't visible. You can leave the group
    attached to the report, you just need to set the group object's properties
    so that it won't start a new page or new column, or keep together when the
    report runs. To re-enable the grouping, you can set the group heeader and
    footer bands to visible = true, and reset the group properties back to true,
    such as Group1.KeepTogether := True.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.