How to set the path for "uses" directive in report script

edited August 2011 in FastReport 4.0
Hi all.

I have a report that contains a MasterData-band, a groupheader and a groupfooter, listing data fro an IBXQuery.
The grouping condition has to be calculated and can't be read directly from the Query. So I try this:

1. In the MasterDetail.OnBeforePrint I use code to store the grouping condition in a variable.
2. In the GroupHeader I set the variable as the condition.

The result is that I get grouping, but 1 record to late. The first record of next group ends up in the previous group.
I suppose the variable calculation happens to late for the grouping.

Using an expression in the Groupheader.condition is not an option in this case, due to the complex grouping condition.

Any hints anyone? Where can I put the calculation of my grouping-variable, so that it gets right for the group header?

Edit: Sorry about the wrong title for this post, (started as one post, ended as another...)

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:37PM
    use the OnStart Report event.
  • edited 5:37PM
    Additional information:

    My querydata look like this:

    Type Text
    A Group text 1
    B Detail text1
    B Detail text2
    B Detail text3
    A Group text 2
    B Detail text4
    B Detail text5
    A Group text 3
    B Detail text6
    B Detail text7

    What I need is a new group starting each time the type is A.
    So I put this in the detailband.OnBeforePrint:

    if <MyQuery."Type"> = 'A' then
    Set('MyGroupingVariable', <MyQuery."Text">);

    and in the groupheader.Condition: <MyGroupingVariable>.

    If I could set up my query with the grouping condition as a field the problem would be solved, but this is not that easy in this case.
  • edited 5:37PM
    Thanks. Do you mean the report.OnStartReport? It does not seem to help me, because I need an event that fires for each record, so that the value of my variable can be recalculated for the grouping.
    I've posted som additional information about my data.
    gordk wrote: »
    use the OnStart Report event.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.