How to remove the condition for a group header?

hsmhsm
edited January 2016 in FastReport 4.0
I have a reasonably simple grouped report that I can run from different datasets, each grouped by a different field.
My main Delphi application selects the dataset to use and programatically alters the GroupHeader.condion, depending upon which dataset it is using.

This works OK except for the ungrouped dataset for which I want to delete the grouping condition altogther and make the group band invisible. This gives me the error
'GroupHeader1:Error in Expression: Expression expected"

The Delphi code I use to alter the group header is below. Can anyone suggest how I get the 'ByAll' condition to work corectly?

(Interestingly, If I design the report with no condition and comment out the GroupHeader1.Condition := ''; line it seems to work OK but I would still like to know how I can set the condition to nothing using code as this will be necessary elsewhere)
procedure TFrmCrossTab.SetUpReport(GroupBy: TGroupBy);
var
  GroupHeader1 :TfrxGroupHeader;
  GroupHeaderTitle: TfrxMemoView;
  
begin
Query.sql := SQL_GroupedReportData(GroupBy); //function to generate correct data

//adapt the report's group header accordingly

GroupHeader1 := frxReport2.FindObject('GroupHeader1') as TfrxGroupHeader;
GroupHeaderTitle  := frxReport2.FindObject('GroupHeaderTitle') as TfrxMemoView;

case GroupBy of
  ByYear: begin
             GroupHeader1.Condition := 'frxDBDataset1."YearNumber"';
             GroupHeaderTitle.Text :=  'Year: [frxDBDataset1."Yearnumber"]';
             GroupHeader1.Visible := True;
             end;

 ByMonth: begin
                GroupHeader1.Condition := 'frxDBDataset1."Month"';
                GroupHeaderTitle.Text :=  'Month: [frxDBDataset1."Month"]';
                GroupHeader1.Visible := True;
                end;

 ByAll: begin
          GroupHeader1.Condition := ''; //<--- this gives the error
          GroupHeader1.Visible := False;
          end;
end;  //case
end;

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.