Subject Re: [IBO] TIB_Script macros
Author Lele Gaifax
>>>>> 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.