cancel
Showing results for 
Search instead for 
Did you mean: 

IN formula field HOw to check sub group changing in a group

Former Member
0 Kudos
62

Hi

IN formula field How to check  sub group changing in a group

In my report each group divided into subgroup and in each subgroup i am calculating discount on some value

I have a  formula field in subgroup its calculating  discount of some value 

here my problem is i want to show sum of discount values in group footer of each sub group

but in my formula how i check sub group changing

This is the formula in group footer 2

1)

@Discount :

(({tbl_1e.ID_P_Discount} / 100) * {#Pub_TotalAmount})

2)

and i created a formula field in same footer 1 and suprressed

@Footer2_discount

numberVar B:=B+{@Pub_Discount};

3)

In Footer1 in group

WhilePrintingRecords;

{@Footer2_discount}-{@Discount};

here i need sum  of every subgroup discount separately for each  group

Accepted Solutions (0)

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

To get the start of a new group use Previous() to get the end of the current group use Next().

So, for example, to get the sum of the discount values, here is a sample for you to work from:

NumberVar totalDiscount;

//initialize totalDiscount at the beginning and for each change of Group 1 field.

if PreviousIsNull({group1 field}) or {group1 field} <> Previous({group1 field}) then totalDiscount := 0;

//Add the discount at the end of each Group 2

if {group2 field} <> next({group2 field} then

  totalDiscount := totalDiscount + {@Discount};

totalDiscount

-Dell