Telling a group header on which database field to group by

edited March 2012 in FastReport 4.0
I am generating my report using code, as defined in the programmer's manual. This is useful for us to have reports built this way. Our limitations with Rave has been its designer, which creating new reports.

However, I am working on a relatively simple report. It takes one stored procedure's results, but I still need to present it in a master-detail kind of way. One field in the result separates each group. But I cannot figure out how to tell FastReports to create another GroupHeader whenever this field changes. Right now, it just creates one header at the top, regardless if I create it as a Header, a GroupHeader or whatever.

Essentially, I am looking for something akin to RaveReports' GroupDataView and GroupKey.

Ah, apparently, I need to use Condition on the GroupHeader. However, I cannot figure out what name my dataset has within the report.

Edit: Setting the UserName apparently works.

Still, I keep getting this error when trying to format a DateTime element into a Date:

'Memo4: Error in expression 'FormatDateTime(<Fisk."SysTm">, "Short Date")': ')' expected'.

I have no idea what ')' expected is supposed to mean.

Thanks in advance.

Comments

  • gpigpi
    edited 5:20PM
    Try to use condition like FormatDateTime('dd.mm.yyyy', <Fisk."SysTm">)
  • edited March 2012
    gpi wrote: »
    Try to use condition like FormatDateTime('dd.mm.yyyy', <Fisk."SysTm">)

    Thank you, that worked excellent. It was actually for a Memo.Text, but still; great. What confuses me, however, is because your suggestion - which works - contradicts what it says in the manual (albeit for 4.0, but I suspected such a major change to a common function would be unusual); any manual I can obtain that is updated with these subjects?

    I have a more difficult - unusual perhaps? - question. If a Memo's data is the same as it was in its previous occurrence, I want it to be invisible (Visible:=false), but visible once again the data changed. But it is also important for the data to reappear even if it the same as last time, but if a new GroupHeader has appeared.

    e.g. An illustration:
    [ GROUP HEADER ]
    Friday    2011-01-04  Time1  More data
                          Time2  More data
    Saturday  2011-01-05  Time3  More data
                          Time4  More data
    [ GROUP HEADER ]
    Saturday  2011-01-05  Time5  More data
    

    I hope that make sense. I realised it made it more readable to have the dates disappear if they are the same, because it is implied.

    Slightly unrelated; I also wonder about a highlight question. It's great that you can use conditioning for highlighting, like not <Line#> mod 2, however you may expect in this report, that after a group header, a highlighted row may appear, when this is undesirable. Essentially, after each group header's appearance, the condition should default to not highlighted and the highlight should continue the reverse. Is it possible to write an expression to ensure a highlight is based on whether the previous' row highlight was active?

    For instance: Memo.Highlight.Condition := 'not ' + Memo.Name + '.Highlight.Active';

    Then have the GroupHeader's OnAfterPrint be Memo.Name + '.Highlight.Active:=true'; or something.
  • gpigpi
    edited March 2012
    wrote:
    I have a more difficult - unusual perhaps? - question. If a Memo's data is the same as it was in its previous occurrence, I want it to be invisible (Visible:=false), but visible once again the data changed. But it is also important for the data to reappear even if it the same as last time, but if a new GroupHeader has appeared.
    Set TfrxMemoView.SuppressRepeated to True
    wrote:
    Slightly unrelated; I also wonder about a highlight question. It's great that you can use conditioning for highlighting, like not <Line#> mod 2, however you may expect in this report, that after a group header, a highlighted row may appear, when this is undesirable. Essentially, after each group header's appearance, the condition should default to not highlighted and the highlight should continue the reverse. Is it possible to write an expression to ensure a highlight is based on whether the previous' row highlight was active?

    For instance: Memo.Highlight.Condition := 'not ' + Memo.Name + '.Highlight.Active';

    Then have the GroupHeader's OnAfterPrint be Memo.Name + '.Highlight.Active:=true'; or something.
    Use <Line> mod 2 highlight expression
  • edited 5:20PM
    That worked. I went a bit of a different method for the highlight condition, because the regular version would still highlight them regardless of the Group Header. So instead, I created a script variable that is increased on each print of a row, but set to 0 on each print of a Group Header and set the condition to 'not <Variable> mod 2'. Works great.

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.