SUM Problem (or Trick), How to use "smart" SUM

类别:编程语言 点击:0 评论:0 推荐:

Q:
Does anybody know how to do next SUM?

1. How to put SUM of all fields on one page in the footer of that page?
2. How to transfer this sum ( point 1) to the header of the next page ( page + 1)?
3. How to transfer this sum and all other sum of another page on the last page?

A:
place memos in the footer and use sumfunctions extended syntax
ie
mdband name band1
has 3 memos containg [tbl."fld1"] [tbl."fld2"] [tbl."fld3"]
in footer
3 memos each would contain [Sum([tbl1."fld1"],band1,1)] and so on.

better to use a column footer and column header band

for the same memos in the colum header
use an if function
[if expression truevalue,falsevalue] in each memo

[if [page#]> 1 ,[Sum([tbl1."fld1"],band1,1)],0] and so on
build the memos expression using the expression builder to get the syntax correct.

if this does not give you the correct totals in the header
then you will have to make report 2pass
and use arrays to gather each field's sum in footer on first pass
and then use an if finalpass then code block in the obp of the header sub the values stored in the arrays

if you need info on arrays see the reports demo grouptotals in header for an example.

本文地址:http://com.8s8s.com/it/it24225.htm