Print Page | Close Window

Abs value of Sub Total field

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=509
Printed Date: 18 Apr 2024 at 7:35pm


Topic: Abs value of Sub Total field
Posted By: VivTheKing
Subject: Abs value of Sub Total field
Date Posted: 11 Apr 2007 at 3:11pm
Hi,
 
I want to have a Trans Total field at the end of the report that should sum the abs value of the Sub Totals.
 
Any help would be greatly appreciated.
 
Thanks in Advance.



Replies:
Posted By: hilfy
Date Posted: 11 Apr 2007 at 3:51pm
You might be able to do this using a variable....I don't guarantee this will work, but you could try something like this:
 
Numbervar TransTotal;
If PreviousIsNull({table.subtotal group field}) then TransTotal := 0;
If NextIsNull({table.subtotal group field}) or ({table.subtotal group field} <> next({table.subtotal group field})) then
  TransTotal := TransTotal + abs(sum({table.field to total}, {table.subtotal group field});
TransTotal
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window