How to remove the condition for a group header?
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
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)
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;