Variable.OnGetText
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
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
This discussion has been closed.
Comments
I think you better use the 'OnCalc' event.
regards,
Chris Ueberall;
I tried that. Its still not refreshing the text with the new values from
the second pass.
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;
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
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;
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
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