mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 03:06:34 +02:00
* Public function to add built-ins to expression parser identifiers
git-svn-id: trunk@38382 -
This commit is contained in:
parent
8ffde52974
commit
0be6c4538c
@ -1544,6 +1544,7 @@ type
|
|||||||
Procedure StartDesigning; virtual;
|
Procedure StartDesigning; virtual;
|
||||||
Procedure EndDesigning; virtual;
|
Procedure EndDesigning; virtual;
|
||||||
procedure RenderReport(const AExporter: TFPReportExporter);
|
procedure RenderReport(const AExporter: TFPReportExporter);
|
||||||
|
procedure AddBuiltinsToExpressionIdentifiers(Idents: TFPExprIdentifierDefs); virtual;
|
||||||
Property Variables : TFPReportVariables Read FVariables Write SetVariables;
|
Property Variables : TFPReportVariables Read FVariables Write SetVariables;
|
||||||
Property ExpressionParser : TFPExpressionParser Read FExpr;
|
Property ExpressionParser : TFPExpressionParser Read FExpr;
|
||||||
{$IFDEF gdebug}
|
{$IFDEF gdebug}
|
||||||
@ -7297,6 +7298,22 @@ begin
|
|||||||
FVariables[i].RestoreValue;
|
FVariables[i].RestoreValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFPCustomReport.AddBuiltinsToExpressionIdentifiers(Idents : TFPExprIdentifierDefs);
|
||||||
|
|
||||||
|
begin
|
||||||
|
Idents.AddDateTimeVariable('TODAY', Date);
|
||||||
|
Idents.AddStringVariable('AUTHOR', Author);
|
||||||
|
Idents.AddStringVariable('TITLE', Title);
|
||||||
|
Idents.AddFunction('RecNo', 'I', '', @BuiltinExprRecNo);
|
||||||
|
Idents.AddFunction('PageNo', 'I', '', @BuiltinGetPageNumber);
|
||||||
|
Idents.AddFunction('ColNo', 'I', '', @BuiltinGetColumnNumber);
|
||||||
|
Idents.AddFunction('PageNoPerDesignerPage', 'I', '', @BuiltInGetPageNoPerDesignerPage);
|
||||||
|
Idents.AddFunction('InRepeatedGroupHeader', 'B', '', @BuiltInGetInRepeatedGroupHeader);
|
||||||
|
Idents.AddFunction('InIntermediateGroupFooter', 'B', '', @BuiltInGetInIntermediateGroupFooter);
|
||||||
|
Idents.AddFunction('IsOverflowed', 'B', '', @BuiltInGetIsOverflowed);
|
||||||
|
Idents.AddFunction('IsGroupDetailPrinted', 'B', '', @BuiltinGetIsGroupDetailsPrinted);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFPCustomReport.InitializeDefaultExpressions;
|
procedure TFPCustomReport.InitializeDefaultExpressions;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -7308,17 +7325,7 @@ begin
|
|||||||
FExpr.Clear;
|
FExpr.Clear;
|
||||||
FExpr.Identifiers.Clear;
|
FExpr.Identifiers.Clear;
|
||||||
FExpr.BuiltIns := [bcStrings,bcDateTime,bcMath,bcBoolean,bcConversion,bcData,bcVaria,bcUser, bcAggregate];
|
FExpr.BuiltIns := [bcStrings,bcDateTime,bcMath,bcBoolean,bcConversion,bcData,bcVaria,bcUser, bcAggregate];
|
||||||
FExpr.Identifiers.AddDateTimeVariable('TODAY', Date);
|
AddBuiltInsToExpressionIdentifiers(FExpr.Identifiers);
|
||||||
FExpr.Identifiers.AddStringVariable('AUTHOR', Author);
|
|
||||||
FExpr.Identifiers.AddStringVariable('TITLE', Title);
|
|
||||||
FExpr.Identifiers.AddFunction('RecNo', 'I', '', @BuiltinExprRecNo);
|
|
||||||
FExpr.Identifiers.AddFunction('PageNo', 'I', '', @BuiltinGetPageNumber);
|
|
||||||
FExpr.Identifiers.AddFunction('ColNo', 'I', '', @BuiltinGetColumnNumber);
|
|
||||||
FExpr.Identifiers.AddFunction('PageNoPerDesignerPage', 'I', '', @BuiltInGetPageNoPerDesignerPage);
|
|
||||||
FExpr.Identifiers.AddFunction('InRepeatedGroupHeader', 'B', '', @BuiltInGetInRepeatedGroupHeader);
|
|
||||||
FExpr.Identifiers.AddFunction('InIntermediateGroupFooter', 'B', '', @BuiltInGetInIntermediateGroupFooter);
|
|
||||||
FExpr.Identifiers.AddFunction('IsOverflowed', 'B', '', @BuiltInGetIsOverflowed);
|
|
||||||
FExpr.Identifiers.AddFunction('IsGroupDetailPrinted', 'B', '', @BuiltinGetIsGroupDetailsPrinted);
|
|
||||||
lHasAggregates:=false;
|
lHasAggregates:=false;
|
||||||
For I:=0 to FVariables.Count-1 do
|
For I:=0 to FVariables.Count-1 do
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user