ltannous
18th March 2004, 20:52
When I run this report entering one selection in the range on the form, the report works properly, however, when I run a range the data seems to double some figures on the report.
I tried seting the variables = 0 at different layouts, but no luck.
The balance and balance1 seems to double.
Any suggestions


before.wtpur041.dim4.1:
before.layout:

travel = 0
courier = 0
balance = 0
balance1 = 0
credit = 0
credit1 = 0
fcah = 0
fdah = 0
fcah1 =0
fdah1 =0

select tfgld010.*
from tfgld010
where tfgld010.dimx = :wtpur041.dim4
selectdo
endselect

select tccom000.*
from tccom000
selectdo
endselect

|Get Travel Expenses
select sum(tfgld202.fdah):fdah, sum(tfgld202.fcah):fcah
from tfgld202, wtpur008
where tfgld202.dimx =:wtpur041.dim4
and tfgld202.dtyp = 4
and tfgld202.ptyp = tfgld.ptyp.financial
and tfgld202.leac = wtpur008.leac
and tfgld202.leac <> "78207"
selectdo
endselect
travel = fdah
credit = fcah
|Balance for travel expenses
balance = travel - credit

|Courier Expenses
select sum(tfgld202.fdah):fdah1, sum(tfgld202.fcah):fcah1
from tfgld202, wtpur008
where tfgld202.dimx =:wtpur041.dim4
and tfgld202.dtyp = 4
and tfgld202.ptyp = tfgld.ptyp.financial
and tfgld202.leac = wtpur008.leac
and tfgld202.leac = "78207"
selectdo
endselect
courier = fdah1
credit1 = fcah1
balance1 = courier - credit1

Ruskin
19th March 2004, 03:04
There could be a number of different things happening here.... My primary concern, would be if there is a total field in your before.wtpur041.dim4.1 report layout.

For example, if your report (with the range) goes over one page, then the before layouts will print, unless you supress them (ie: condition the layout to 'lattr.break', so that a break in the sort sequence will cause them to print, not a page break)... Although, the variables are reset, before the layout prints anyway, there could be aggregate functions (ie: 'Total') in the report field setup on that layout... If this is the case, then the variables will have a running total, each time the layout is printed, until the value of wtpur041.dim4 changes....

If this field is a total, then remove the aggregate function. NOTE: to make your script a bit quicker (so that it doesn't recalculate the values each time the layout prints, for the same wtpur041.dim4 value), put it between;
if lattr.break then
:
:
endif

Ruskin
19th March 2004, 03:06
Sorry, meant to add.

You could try resetting the variables to zero, in the after.layout sub section, as well....

ltannous
19th March 2004, 03:44
Thanks for your adivce. It worked