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

TppVariable OnCalc via Code.

edited September 2008 in RAP
Hi,

Is it possible to create a TppVariable within the code and assign it
an OnCalc function?

The number of column in my report is variable and created in the code
(JITPipeline), I have a DBCalc total for each column, but these
floating point values then needs to be converted into strings and
displayed...

I canno't think of any way to do this...

Thankx
Chantal

Comments

  • edited September 2008
    Hi Chantal,

    Take a look at the following article/example. It shows how you can
    dynamically create multiple variable objects and assign their individual
    values by keeping track of them in a TList object.

    http://www.digital-metaphors.com/rbWiki//RAP/Fundamentals/How_To...Dynamic_Variables_in_RAP

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2008
    Hi Nico,

    That example is actually very similar to what I did.
    I used the OnCalc of one TppVariable defined on the layout to set the
    values in "TppLabels" objects made via the code and kept in a list,
    considering they are just strings I didn't use a tppVariable.

    My problem was that I wanted to define that TppVariable via the code,
    and not on the design window, considering it's not always needed. But
    I canno't assign it an OnCalc function...

    Only from the report design, when I select the variable I can
    create/assign an OnCalc via the object inspector of Delphi...

    For example, with a combobox component I can make my own
    "OnValueChanged" method and assign it cbxCombo.OnValueChanged =
    method.

    This doens't work with tppVariables?
    I was wondering if I was doing something wrong or if it just works
    this way and it's never possible to assign an OnCalc function via the
    code.


    Chantal

    On Thu, 25 Sep 2008 09:40:18 -0600, "Nico Cizik \(Digital Metaphors\)"
  • edited September 2008
    Hi Chantal,

    Assigning an event to a component is not supported in RAP. One option would
    be to create a passthru function that passes the component itself so a
    Delphi event can be assigned. Otherwise, you would need to do something
    like the example I sent earlier by using the event of another component to
    make calculations.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2008
    Thank you!

    Chantal

    On Tue, 30 Sep 2008 07:17:41 -0600, "Nico Cizik \(Digital Metaphors\)"
This discussion has been closed.