I assume you are using RAP. RAP does not include a built-in string replace routine. This is something we will consider adding for a later release.
Currently you can create a passthru function to preform the string replace in Delphi or use a combination of Delete, Insert, and Pos to achieve the same thing. See the RAP demos on how to create a passthru function.
thanks for your answer. I wanted to take a look at the demos, but on my installation there is no demo-folder. So I tried to reinstall report builder, but there was no option for installing the demos. How do I get them?
sorry for asking again, but I don't check it with the passthru function. I looked at the demo example and tried to modify the trim function in example "myRapFuncs0031".
I don't really undestanding how to code the ExecuteFunction. Also, after compiling the project I get the error "Cannot compile signature for String function: StringReplace".
Once more - thank you very much for you help! Greets, ben
type TmyStringReplaceFunction = class (TraStringFunction) public procedure ExecuteFunction(aParams: TraParamList); override; class function GetSignature: String; override; end;
implementation
class function TmyStringReplaceFunction.GetSignature: String; begin Result := 'function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;';
end; {class function, GetSignature}
procedure TmyStringReplaceFunction.ExecuteFunction(aParams: TraParamList); var lsResult: String; S : string; OldPattern :string; NewPattern: string; Flags: TReplaceFlags; begin
I do not believe RAP will recognize the TReplaceFlags type. Try sending an integer instead then based on that value assign the TReplaceFlags equivalent when calling StringReplace in Delphi.
It is also possible to register an enumerated type with RAP using the raRegisterEnum routine so the TReplaceFlags type will be recognized. Take a look at the ppEnum.pas file for how we do this in ReportBuilder.
Comments
I assume you are using RAP. RAP does not include a built-in string replace
routine. This is something we will consider adding for a later release.
Currently you can create a passthru function to preform the string replace
in Delphi or use a combination of Delete, Insert, and Pos to achieve the
same thing. See the RAP demos on how to create a passthru function.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thanks for your answer.
I wanted to take a look at the demos, but on my installation there is no
demo-folder.
So I tried to reinstall report builder, but there was no option for
installing the demos. How do I get them?
Thank you!
Nico Cizik (Digital Metaphors) schrieb:
http://www.digital-metaphors.com/rbWiki/General/Installation/Tech_Tip:_Demo_Location
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
sorry for asking again, but I don't check it with the passthru function.
I looked at the demo example and tried to modify the trim function in
example "myRapFuncs0031".
I don't really undestanding how to code the ExecuteFunction.
Also, after compiling the project I get the error "Cannot compile
signature for String function: StringReplace".
Once more - thank you very much for you help!
Greets,
ben
Code:
unit myRapFuncs0031;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, Dialogs, raFunc, ppRTTI;
type
TmyStringReplaceFunction = class (TraStringFunction)
public
procedure ExecuteFunction(aParams: TraParamList); override;
class function GetSignature: String; override;
end;
implementation
class function TmyStringReplaceFunction.GetSignature: String;
begin
Result := 'function StringReplace(const S, OldPattern, NewPattern:
string; Flags: TReplaceFlags): string;';
end; {class function, GetSignature}
procedure TmyStringReplaceFunction.ExecuteFunction(aParams: TraParamList);
var
lsResult: String;
S : string;
OldPattern :string;
NewPattern: string;
Flags: TReplaceFlags;
begin
GetParamValue(0, S);
GetParamValue(1, OldPattern);
GetParamValue(2, NewPattern);
GetParamValue(3, Flags);
lsResult := StringReplace(S,OldPattern,NewPattern,Flags);
SetParamValue(1, lsResult);
end; {procedure, ExecuteFunction}
initialization
raRegisterFunction('StringReplace', TmyStringReplaceFunction);
finalization
raUnRegisterFunction('StringReplace');
end.
Nico Cizik (Digital Metaphors) schrieb:
I do not believe RAP will recognize the TReplaceFlags type. Try sending an
integer instead then based on that value assign the TReplaceFlags equivalent
when calling StringReplace in Delphi.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
raRegisterEnum routine so the TReplaceFlags type will be recognized. Take a
look at the ppEnum.pas file for how we do this in ReportBuilder.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Greets, ben
Nico Cizik (Digital Metaphors) schrieb: