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

Problem with RB 12.05 and ShiftRelativeTo

edited July 2011 in General
Hello,

I just made an upgrade from RB 12.04 Ent. to 12.05 with Delphi 7.

After recompiling my projects most the reports works fine.

But some reports makes an exception "ShiftRelativeTo is not allowed when
Parent is a region."

What can I do?

Kind regards,
Gerd Brinkmann
invent GmbH

Comments

  • edited July 2011
    Hi Gerd,

    Are you able to recreate this with a simple example? If so, please send
    the example in .zip format to support@digital-metaphors.com and we'll
    take a look at it for you.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2011
    Hi Nico,

    thank for the fast response.

    My Problem is, that I have many reports (> 200) with much more
    ShiftRelativeTos. All are saved into a database. Now I cannot open this
    reports. No PrintPreview, no Designer. I just re-installed RB 12.04 and
    everything works fine.

    It's not easy to make an example. But I try to explain the problem:

    In a report I have different TppRegions, which all contains a TppLabel and a
    TppDBMemo or a TppSubreport. For example:

    ppRegion1 contains ppLabel1 and ppDBMemo1
    ppRegion2 contains ppLabel2 and ppDBMemo2
    ppRegion3 contains ppLabel3 and ppSubReport1

    Now normally is

    ppRegion2.ShiftRealativeTo = ppRegion1
    ppRegion3.ShiftRealativeTo = ppRegion2

    and nothing else. Unfortunately it can be, than an additional setting
    exists, like:

    ppDBMemo2.ShiftRelativeTo = ppRegion1

    or

    ppSubReport1.ShiftRelativeTo = ppRegion2

    In one of this cases I cannot open the report, because of the exception
    "ShiftRelativeTo is not allowed when Parent is a region."

    In RB 12.04 there is no exception.

    So my 2 problems are:

    1. I cannot open the report with designer.

    2. How to find out which reports are affected by the change?

    Thanks in advance for any help.

    Kind regards,
    Gerd Brinkmann
    invent GmbH




  • edited July 2011
    There is now a patch available for RB 12.05 that will suppress the
    exception when loading existing reports. Registered RB 12.05 can email
    support@ and request the patch.

    The configuration you describe, in which you have Regions with
    ShiftRelativeTo relationships is not the issue.

    The limitations have always been that a Region cannot contain a Region. And
    elements inside regions cannot participate in a ShiftRelativeTo
    relationship. For example, if you have two memos in a region, memo1 cannot
    ShiftRelativeTo memo2. The Popup menu suppresses the option, but the Object
    Inspector allowed the settings, thus we added the new validation code based
    on customer feedback.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2011
    Hello Nard,

    thank you very much for the fix.

    But I don't have a region in aregion, and I don't have a region with two
    memo or something. I validate my RTM-File and the problem is:

    ppRegion1 contains ppLabel1 and ppDBMemo1
    ppRegion2 contains ppLabel3 and ppSubReport1

    ppSubReport1.ShiftRelativeTo = ppRegion1

    Just for your information. If you need, I wil send you the RTM-file.

    Thanks again for your solution.

    Kind regards,
    Gerd Brinkmann
    invent GmbH



  • edited July 2011
    In your example, Subreport1 resides inside Region2 and therefore cannot
    participate in a ShiftRelativeTo relationship. This is exactly the error
    message - "ShiftRelativeTo is not allowed when parent is a Region."

    Region2 can ShiftRelativeTo Region1.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2011
    Hello Nard,

    okay, now it's clear. I misunderstood your posting from 18.07.2011.

    One last question: Is there a way to find out, which Reports are "wrong".
    Maybe a test-program? I have many reports and some of them are 10 years old.
    I think, this mistake is in most of the older reports.

    Thank you again and kind regards,
    Gerd Brinkmann
    invent GmbH


  • edited July 2011

    If the reports have been like that for 10 years, one option is to leave them
    like that. Another option is to write a program to load the reports,
    iterate over the Report.Bands[].Objects[] structure.

    Here is an example of iterating over the report layout structure

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Report_Object_Loop

    To check for the condition would be something like this....

    uses
    ppStrtch;

    lComponent := myReport.Bands[liBand].Objects[liObject];

    if (lComponent is TppStretchable) then
    begin
    lStretchable := TppStretchable(lComponent);

    if (lStretchable.Parent is TppRegion) and
    (lStretchable.ShiftRelativeTo <> nil) then
    //remove invalid relationship
    lStretchable.ShiftRelativeTo := nil;

    end;



    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.