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

Variable.OnGetText

edited July 2002 in General
I have a report that calculates a value for a variable in the OnGetText
event and I assign it to its text.
On the reports OnStartSecondPass I use a sum in the calculation that changes
the value. However when I preview the report
the values calculated in the first pass are shown and not the second pass.
How do I get my variable to show the result from the second pass in the
report.

thx
John Kerns

Comments

  • edited July 2002
    Hi John,

    I think you better use the 'OnCalc' event.

    regards,
    Chris Ueberall;

  • edited July 2002
    Chris

    I tried that. Its still not refreshing the text with the new values from
    the second pass.

    John


  • edited July 2002
    John,

    I guess the value passed isn't uptodate.
    Can you tell us what you want to achieve?
    How and where do you summing?
    What is your report layout (subreports)?

    regards,
    Chris Ueberall;

  • edited July 2002
    Ok , heres what Im trying to accomplish. Im working with two dbtext fields.
    Call them DB1 and DB2.
    I have a sum on the DB2 field called SUMDB2. Then I have a variable called
    VAR1.

    what i want to do is divide DB1 by the SUMDB2 and assign it to VAR1.

    example

    DB1 DB2 VAR1

    10 1 2
    05 2 1
    15 2 3

    SUMDB2
    5


    My attempt to accomplish this is set a GlobalVar called gVar and on the
    Report.OnStartSecondPass assign the
    SUMDB2.Value to gVar.
    Then in the VAR1.OnCalc I divide DB1.FieldValue by gVar and then try to
    assign it to VAR1.text.

    When I do a showmessage on the values they are correct in the second pass.
    What is happening is I dont get the values calculated in the second pass to
    show up, just the first pass.

    Hope this make sense.

    Thx
    John Kerns




  • edited July 2002
    John,

    Does that mean, that you check the values in the 'OnCalc' event of 'Var1'?
    The critical value is 'SUMDB2' resp. 'gVar'. If 'gVar' holds the right
    value, I can't imagine why 'Var1' doesn't display the expected value.

    regards,
    Chris Ueberall;

  • edited July 2002
    ok nevermind the value. if i put in something like this in the varible
    OnGetText

    if Report.FirstPass
    Text := 'First'
    else
    Text := 'Second'

    Am I correct in assuming that the report should show 'Second' in the
    variable since that was the last assignment.
    Instead its showing 'First'. Where am I wrong?

    thx JKerns




  • edited July 2002
    ok the passsetting should do this.
    i set it in a the particular report and its not working. however i tried it
    in a new one and it works so im guessing something is goofy with the bad
    one. thanks for the help.

    John Kerns
This discussion has been closed.