Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Set TppVariable.OnCalc during run time

edited December 2009 in General
Hello,
I create a TppVariable during run time. Now I need to know how to create an
TppVariable.OnCalc event and fill it with code during run time.

Best regards,
Kai

Comments

  • edited December 2009
    Hi Kai,

    This is the code I use to create a TppVariable and assign the OnCalc event
    at runtime.

    Greetings,
    Filip

    with TppVariable(ppComponentCreate(MyReport,TppVariable)) do
    begin
    Band := MyReport.DetailBand;
    DataType := dtInteger;
    Visible := False;
    CalcType := veTraversal;
    ResetType := veReportEnd;
    OnCalc := ppIntVarCOUNTCalc;
    end;



  • edited December 2009
    Thanks Filip,

    but I need to write the Report-Event-Code (RAP, not a delphi procedure) in
    delphi. I have to change some existing reports and I must add a TppVariable
    with a OnCalc event in the report. So I have to write the code (later
    visible in the report-viewer) in delphi.

    I need something like that:

    ppOnCalcEvent.Source.Add('if x=0 then x:=1 end;');
    ppVariable.OnCalc := ppEvent;


    Best regards,
    Kai
  • edited December 2009

    The RAP demos installed with the product include an example of creating RAP
    event-handlers in code. Open Demos\RAP\Main and check out demo 41.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.