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

Setting a TppDBText's value dynamically

edited March 2003 in General
Hello,

I am *brand* new to Report Builder.

I have a report form that has an enumerated type private variable to
indicate to many templates whether to use the source's "First and Last" or
"Organization" as the recipient field on label templates.

I would like to at runtime assign a value or caption to a label on the
report for each record as it prints based on this private variable.


--
Reid Roman
Future Generation Software
http://www.fgsoft.com
reidr@fgsoft.com

Comments

  • edited March 2003
    Reid,

    Try using the Report.BeforPrint event to assign the Label.Caption to a
    string, and then if you want to change the label for each record use the
    Label.OnGetText event to assign values to them.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2003
    I have used the latter approach and it works.

    What I would like to do is have a component on the form that could have it's
    "formula" set at runtime to display common things like City, St Zip on one
    line. Or a label for the recipient (again in this scenario it is using the
    Avery label templates) The formula could use a few keywords and operators to
    make runtime decisions like :

    if (DataPipeline.GetFieldAsString('Organization') = '') then Formula :=
    DataPipeline.GetFieldAsString('First') + ' ' +
    DataPipeline.GetFieldAsString('Last')


    I am doing it now by creating a common OnPrint() and GetText() handlers that
    numerous labels use to set their values based on other internal variable to
    indicate what report to act on when the handler
    fire.

    I was hoping that RB has an inherent way to control this based on some
    internal formula attached to a label or DBText label.

    Like I said I am new but is the Variable component something that could be
    used for this?

    --
    Reid Roman
    Future Generation Software
    http://www.fgsoft.com
    reidr@fgsoft.com
  • edited March 2003
    "Reid Roman" wrote in message news:3e84faed@dm500....
    it's
    the
    to

    Thought I might chime in. I would suggest that you use a single TppVariable
    component and code its OnCalc event to assign the value to be diplayed. You
    could use the Tag property to store the "calculation" type to be used at
    runtime. Then in code you can have a case for each of the "calculation"
    types and write your code there using your enumerated private variable.

    HTH
    Vikram
  • edited March 2003
    Ok,

    So can the TppVariable do things like sum() on a column or records counts,
    etc in it's OnCalc() event?

    Thanks,

    --
    Reid Roman
    Future Generation Software
    http://www.fgsoft.com
    reidr@fgsoft.com

  • edited March 2003
    "Reid Roman" wrote in message news:3e850c0f$1@dm500....

    Well, it can do it if you write the "sum()" logic in the OnCalc event. The
    TppVariable is a component to do custom calculations whereas the TppDBCalc
    object does standard calculations like Sum, Avg, Count etc. You create the
    component depending on the calculation type selected by the user. If it is a
    standard calculation type then just create a TppDBCalc object else create a
    TppVariable and code the OnCalc event handler. You can also control the
    timing and calculate order for a TppVariable. We always create a TppVariable
    component for all types of calculations.

    HTH
    Vikram
  • edited March 2003
    Ok great.

    Thanks,

    --
    Reid Roman
    Future Generation Software
    http://www.fgsoft.com
    reidr@fgsoft.com
This discussion has been closed.