Subject | RE: [IBO] TIB_Script macros |
---|---|
Author | Don Schoeman |
Post date | 2001-07-20T08:07:30Z |
Thank you Lele,
It seems simple enough. At what stage is the SQL containing the macro
strings parsed though? Is it before the SQL statement is executed?
Best Regards,
Don Scoeman
-----Original Message-----
From: Lele Gaifax [mailto:lele@...]On Behalf Of Lele Gaifax
Sent: 20 July 2001 09:44
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] TIB_Script macros
DS> Is there an example somewhere on how to use the TIB_Script
DS> macro substitution facility? Or could someone give me a quick
DS> example.
It's very easy: you must implement a method like this
procedure TMyForm.SubstSubquery (Sender: TIB_Component;
const ATextBlock: string;
var ATextResult: string);
begin
if ATextBlock = 'THEMACRO' then
ATextResult := 'The Macro Expanded';
else if ATextBlock = 'THECONDITION' then
ATextResult := 'theField IN (1, 2, 4)';
end
then assign it to the OnMacroSubstitute of you preferred IB_ query,
that may contain something like
SELECT f1, f2, f2 as <<THEMACRO>>
FROM table
WHERE <<THECONDITION>>
The method will be colled once for each macro.
Hope this helps,
bye, lele.
--
nickname: Lele Gaifax | Quando vivro' di quello che ho pensato ieri
real: Emanuele Gaifas | comincero' ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
It seems simple enough. At what stage is the SQL containing the macro
strings parsed though? Is it before the SQL statement is executed?
Best Regards,
Don Scoeman
-----Original Message-----
From: Lele Gaifax [mailto:lele@...]On Behalf Of Lele Gaifax
Sent: 20 July 2001 09:44
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] TIB_Script macros
>>>>> On Fri, 20 Jul 2001 09:11:51 +0200, "Don Schoeman" <ds@...>said:
DS> Is there an example somewhere on how to use the TIB_Script
DS> macro substitution facility? Or could someone give me a quick
DS> example.
It's very easy: you must implement a method like this
procedure TMyForm.SubstSubquery (Sender: TIB_Component;
const ATextBlock: string;
var ATextResult: string);
begin
if ATextBlock = 'THEMACRO' then
ATextResult := 'The Macro Expanded';
else if ATextBlock = 'THECONDITION' then
ATextResult := 'theField IN (1, 2, 4)';
end
then assign it to the OnMacroSubstitute of you preferred IB_ query,
that may contain something like
SELECT f1, f2, f2 as <<THEMACRO>>
FROM table
WHERE <<THECONDITION>>
The method will be colled once for each macro.
Hope this helps,
bye, lele.
--
nickname: Lele Gaifax | Quando vivro' di quello che ho pensato ieri
real: Emanuele Gaifas | comincero' ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/