|
@@ -1411,8 +1411,8 @@ type
|
|
Function FindVariable(aName : String) : TFPReportVariable;
|
|
Function FindVariable(aName : String) : TFPReportVariable;
|
|
Function AddVariable(aName : String) : TFPReportVariable;
|
|
Function AddVariable(aName : String) : TFPReportVariable;
|
|
Function AddDataVariable(aName : String) : TFPReportVariable;
|
|
Function AddDataVariable(aName : String) : TFPReportVariable;
|
|
- Function AddExprVariable(aName : String; aExpr: String; aType: TResultType = rtString; aResetType: TFPReportResetType = rtNone; aResetGroup: TFPReportCustomGroupHeaderBand = nil) : TFPReportVariable;
|
|
|
|
- Function AddExprVariable(aName : String; aExpr: String; aType: TResultType; aResetType: TFPReportResetType; aResetValueExpression: String) : TFPReportVariable;
|
|
|
|
|
|
+ Function AddExprVariable(aName : String; aExpr: String; aType: TResultType; aResetGroup: TFPReportCustomGroupHeaderBand) : TFPReportVariable;
|
|
|
|
+ Function AddExprVariable(aName : String; aExpr: String; aType: TResultType; aResetType: TFPReportResetType = rtnone; aResetValueExpression: String = '') : TFPReportVariable;
|
|
Property Variable[aIndex : Integer] : TFPReportVariable Read GetV Write SetV; default;
|
|
Property Variable[aIndex : Integer] : TFPReportVariable Read GetV Write SetV; default;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2165,8 +2165,10 @@ resourcestring
|
|
SErrUnknownElementName = 'Unknown element name : %s';
|
|
SErrUnknownElementName = 'Unknown element name : %s';
|
|
SErrUnknownElementClass = 'Unknown element class : %s';
|
|
SErrUnknownElementClass = 'Unknown element class : %s';
|
|
SErrResetGroupMissing = 'ResetType is rtGroup but no ResetGroup specified';
|
|
SErrResetGroupMissing = 'ResetType is rtGroup but no ResetGroup specified';
|
|
|
|
+ SErrEmptyResetValue = 'ResetType is specified, but no ResetExpression is provided';
|
|
SErrExprVarisbleAggregateOnWrongLevel= 'ExprVariable has Aggregate but not on highest level: %s';
|
|
SErrExprVarisbleAggregateOnWrongLevel= 'ExprVariable has Aggregate but not on highest level: %s';
|
|
|
|
|
|
|
|
+
|
|
{ includes Report Checkbox element images }
|
|
{ includes Report Checkbox element images }
|
|
{$I fpreportcheckbox.inc}
|
|
{$I fpreportcheckbox.inc}
|
|
|
|
|
|
@@ -2747,9 +2749,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TFPReportVariables.AddExprVariable(aName: String; aExpr: String;
|
|
|
|
- aType: TResultType; aResetType: TFPReportResetType;
|
|
|
|
- aResetGroup: TFPReportCustomGroupHeaderBand): TFPReportVariable;
|
|
|
|
|
|
+function TFPReportVariables.AddExprVariable(aName: String; aExpr: String; aType: TResultType; aResetGroup: TFPReportCustomGroupHeaderBand): TFPReportVariable;
|
|
var
|
|
var
|
|
lGrp: TFPReportCustomGroupHeaderBand;
|
|
lGrp: TFPReportCustomGroupHeaderBand;
|
|
lResetValueExpression: String;
|
|
lResetValueExpression: String;
|
|
@@ -2766,27 +2766,16 @@ var
|
|
end;
|
|
end;
|
|
|
|
|
|
begin
|
|
begin
|
|
- if (aResetType = rtGroup)
|
|
|
|
- and not Assigned(aResetGroup) then
|
|
|
|
|
|
+ if not Assigned(aResetGroup) then
|
|
raise EReportError.Create(SErrResetGroupMissing);
|
|
raise EReportError.Create(SErrResetGroupMissing);
|
|
lResetValueExpression:='';
|
|
lResetValueExpression:='';
|
|
- if Assigned(aResetGroup) then
|
|
|
|
- begin
|
|
|
|
- case aResetType of
|
|
|
|
- rtGroup:
|
|
|
|
- begin
|
|
|
|
- lGrp:=aResetGroup;
|
|
|
|
- while Assigned(lGrp) do
|
|
|
|
- begin
|
|
|
|
- ExtendResetValueExpression(lGrp.GroupCondition, false);
|
|
|
|
- lGrp:=lGrp.ParentGroupHeader;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- rtPage: lResetValueExpression:='PageNo';
|
|
|
|
- rtColumn: lResetValueExpression:='ColNo';
|
|
|
|
|
|
+ lGrp:=aResetGroup;
|
|
|
|
+ while Assigned(lGrp) do
|
|
|
|
+ begin
|
|
|
|
+ ExtendResetValueExpression(lGrp.GroupCondition, false);
|
|
|
|
+ lGrp:=lGrp.ParentGroupHeader;
|
|
end;
|
|
end;
|
|
- end;
|
|
|
|
- Result := AddExprVariable(aName, aExpr, aType, aResetType, lResetValueExpression);
|
|
|
|
|
|
+ Result := AddExprVariable(aName, aExpr, aType, rtGroup, lResetValueExpression);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFPReportVariables.AddExprVariable(aName: String; aExpr: String;
|
|
function TFPReportVariables.AddExprVariable(aName: String; aExpr: String;
|
|
@@ -2796,14 +2785,21 @@ begin
|
|
if (IndexOfVariable(aName)<>-1) then
|
|
if (IndexOfVariable(aName)<>-1) then
|
|
raise EReportError.CreateFmt(SErrDuplicateVariable, [aName]);
|
|
raise EReportError.CreateFmt(SErrDuplicateVariable, [aName]);
|
|
Result:=add as TFPReportVariable;
|
|
Result:=add as TFPReportVariable;
|
|
|
|
+ if (aResetValueExpression='') then
|
|
|
|
+ case aResetType of
|
|
|
|
+ rtPage: aResetValueExpression:='PageNo';
|
|
|
|
+ rtColumn: aResetValueExpression:='ColNo';
|
|
|
|
+ end;
|
|
|
|
+ if (aResetType<>rtNone) and (aResetValueExpression='') then
|
|
|
|
+ raise EReportError.CreateFmt(SErrEmptyResetValue, [aName]);
|
|
with Result do
|
|
with Result do
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
Name:=aName;
|
|
Name:=aName;
|
|
FExpression:=aExpr;
|
|
FExpression:=aExpr;
|
|
DataType:=aType;
|
|
DataType:=aType;
|
|
FResetType:=aResetType;
|
|
FResetType:=aResetType;
|
|
FResetValueExpression:=aResetValueExpression;
|
|
FResetValueExpression:=aResetValueExpression;
|
|
- end;
|
|
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TFPReportVariable }
|
|
{ TFPReportVariable }
|