Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about Subtotals in CS Xi

Status
Not open for further replies.

mapperkids

Programmer
Jun 26, 2006
6
0
0
CA
Hi,

I have a question about the CS Xi, the report layout that I want is like below:



CustomerA Sales 2006 Sales-2005

ProductA 99999 99999
ProductB 99999 99999
ProductC 99999 99999
ProductD 99999 99999

Total: 99999 99999



Question:

Normally, the group total is sum of all the detail belong the group, but I want to put a condition on the total line like

If ProductA is there then the total will only included the sum of productA,B,C but not productD, Otherwise the total will be only included the sume of ProductD and ignore all the other products.

Is that possible and if YES, where I should put this business rule in?

Thank You!





 
What's CS XI?

Why bother posting example data if the totals aren't correct?

I'll assume that you mean that you're using Customer as a grouping.

Create a formula of:

//@AExists
if {table.product} = "producta" then
1
else
0

The create 2 other formulas:

//@NoD
if {table.product} in ["producta","productb","productc"] then
{table.qty}
else
0

//@OnlyD
if {table.product} = "productd" then
{table.qty}
else
0

Now your subtotal formula to be placed in the customer group footer looks something like:

if sum({@AExists},{table.customer}) > 0 then
sum({@NoD},{table.customer})
else
sum({@OnlyD},{table.customer})

Should get you close...can't test right now.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top