Showing results for 
Search instead for 
Did you mean: 

problem regarding crystal report formula if condition

Former Member
0 Kudos

Dear Sir,

i am facing a problem in crystal report formula in which i has to use if condition and perform add and subtract

in a row the design is describe under

_*in qnty_           _production_           _out qnty_*
 *600                      600                            0*
*1200                     1800                            0*
*0                             1300                        500*
*300                      1600                            0*
*0                           1200                        400*
*400                       1600                            0*

in qnty has to add and outqnty have to subtract

i has used this formula




if {@detail}=1 then



if {trialprocedure2;1.InQty}>=0 then

NUM9:= NUM9 +{trialprocedure2;1.InQty}


if {trialprocedure2;1.OutQty}>=0 then

NUM9:= NUM9 -{trialprocedure2;1.OutQty}

plz give solution for this problem

Edited by: bhatt45 on Feb 13, 2012 12:12 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos


Iu2019m able to get the desired results, you may have to follow three steps to create this:

1. Sum the opening qty. Normally we will have only one opening qty, which is off last year closing qty.


2. Create a running total u2013Go in Field exploreru2014Running total u2013new u2013OpenQtyu2014add the open qty field and sum it.

Place the same field in your detail.

3. Create a running total for your out qty also .. follow step two.

4. Now create a formula u2013(Sum(@openqty)+#OpenQty )-#ClQty.

This will give you the closing qty for each row.



Former Member
0 Kudos

I have to take closing of a month to next month opening,In the production quantity.and i dont have to use sum because i have to

show all month entry so i can sum it.So please see the problem.

(opening ) (production) (sales)

or inqnty opening or outqnty

opening should be last month closing

production should be opening +inqnty - outnty

the production should be add and subtraction of inqnty and outqnty

it should form a primid so that production - sales as show closing qnty

diagram is post in pervious post

inqnty                  production             outqnty
0                               1                          0
2                               3                          0
5                                8                          6
0                                2                           1
0                                 1                           0

production should work like this ifonfirstrecord then opening value of last month with show

and in next value inqnty will be add to production and outqnty will be subtract from production and so on the process follow