Home DADE

SQL Parameters

edited August 2006 in DADE
Dear All,

Is it somehow possible to change a dade pipeline's SQL using RAP?

Scenario----------
On my delphi form I have a master pipeline. In my report I want to have a
detail pipeline, which is in master/detail relationship with the
masterpipeline. IT IS NOT POSSIBLE to have the detailpipeline in Delphi, it
is available in the report only.
----------

Can I somehow change the entire SQL text of the detail pipeline in
Report.Beforeprint to something like

'select * from detaildb where masterid='+MainPipeline['ID'];

I tried this:

var V: TdaIBXQueryDataView;
begin
v:=TdaIBXQueryDataView(Detail);
V.SQL.SQLText.Text:='select * from detaildb where
masterid='+MainPipeline['Nomer'];
end;

BUT it doesn't work (whatever I type as sql is ignored, the original SQL of
the pipeline is always executed).

After some investigation I found that TdaIBXQueryDataView(Detail) returns
NIL (still the above code doesn't raise an exception?!).

I found this topic:

------------
Unfortunately, DADE does not support the use of parameters from within the
SQL code. You will need to use the autosearch feature to add or change the
search criteria of a SQL statement in DADE. Note that this has been made
much easier for RB 9 or later with the introduction of the TdaSQLBuilder
object.
-----------
So, OK, I can't pass parameters, but can I change the entire SQL somewhere
in RAP, at Report.BeforePrint for example?

Comments

  • edited August 2006
    Hi Dimitar,

    Yes, it is possible to successfully change the SQL in RAP at runtime.
    Starting with RB 9 we introduced the TdaSQLBuilder class. This class makes
    the task of accessing and altering the SQL object in RAP and Delphi an
    easier one. We also added a number of events including the
    OnBeforeOpenDatapipelines to RAP to make changing the SQL possible as well.
    Take a look at the TdaSQLBuilder topic in the RB help for more information
    and examples.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.