Link dade to exixst pipeline with rap

edited November 2013 in DADE
i'm using RB 14.07 build 326 on Delphi xe.
our db is firebird, with dbexpress lib.

i'm tring to add a detail dataset to some existing reports. i guess to
do it only in rap mode.

i add the daDBExpress unit and i create the correct datasettings to
import a tabel view. i can see all field, and all data correclty.

now i'm trying to add this new dade table as a "detail" of exisitng
pipelines: to do this i add this code in rap:

procedure ReportBeforeOpenDataPipelines;
DADETABLE.SKIPWhennorecords := false;

now in my report i have a strange issue : it starts work correctly, for
about 3 o 4 pages. and then linked dade stop working and always retun
blank dataset.

it seems dade report pointer works until it goes to EOF and then it
can't return to first record to restart job.....

there's some workaround or demo?


  • edited November 2013
    Hi Diego,

    To manipulate the data workspace from RAP, we strongly suggest using the
    TdaSQLBuilder class. This is a wrapper class giving easy access to the
    DADE SQL class. Using the SQL Builder, you can easily create, alter,
    and update any datasets needed for your report in code.

    See the following articles as well as take a look at the help topic for
    TdaSQLBuilder and its subclasses.


    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited November 2013
    I'm trying to use it... but, how can i create a master-detail link with

    should i intercept every "ondetailbeforeprint" and modificy the search
    on dade query with current master value?

    Nel suo scritto precedente, Nico Cizik (Digital Metaphors) ha sostenuto
  • edited November 2013
    I'll explain better :)

    if i add this

    procedure ReportBeforeOpenDataPipelines;
    var lSQLBuilder: TdaSQLBuilder;
    lSQLBuilder := TdaSQLBuilder.Create(DADETABLE);
    lSQLBuilder.SearchCriteria[0].VALUE := EXISITINGMASTER['ID'];

    obviously it show me always the first detail record....

    in which event you suggest i move it ?
    thanks :)

    Diego Rigoni ha usato la sua tastiera per scrivere :
  • edited November 2013
    Hello Diego,

    some time ago we had same problems. I have solved it the following way:

    * create some reportbuilder-rap-functions to define a query, i.e.
    virtualquery(1, 'select * from details where id='+master['id']);

    the virtualquery(id:integer; sql:string); function is creating three
    objects at runtime: tppdbpipeline with name "VirtualQRY"+id,
    tdatasource and a tquery (or tmysqlquery .... etc).

    That means we're initializing "ReportBeforePrint" all needed
    virtual-queries with blank data and on each group or details or ...
    where you need it, we're calling "onbeforegenerate" our virtualquery

    So we have everytime fresh data!

    Could be a better solution than using rap code to link something !!
    I you need code, i can help you

    Best regards, Yusuf

  • edited November 2013
    i have a similar function " TQueryGeneric = class(TraSystemFunction) "
    and it works.

    but in some cases i want to add client query with DADE :)

    the problem is linking dade as a detail to my master datapipeline all
    in rap code.
    i'm trying with parameters too, but it doesnt work :(

    Yusuf Zorlu ha spiegato il 20/11/2013 :
  • edited November 2013
    I found a better pieces of code RAP, it seems works :)

    procedure ReportBeforeOpenDataPipelines;
    lLink: TppMasterFieldLink;
    DADE.MasterDatapipeline := Testa;

    lLink := TppMasterFieldLink.Create(nil);
    lLink.Parent := DADE ;
    lLink.Name := 'RANDOMNAME' ;
    lLink.DetailFieldName := 'ID_MASTER' ;
    lLink.MasterFieldName := 'ID' ;
    DADE.SKIPWhennorecords := FALSe; // <- I need more test on this row

    DADE table must be order by "ID_MASTER" :)

    Diego Rigoni ci ha detto :
  • edited November 2013
    lLink.Parent := MASTERPIPELINE ;

    Sembra che Diego Rigoni abbia detto :
This discussion has been closed.