• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

how to clear shared number variable after printing

I have crystal reports 10, I have a problem,  I using shared numbervar to print each subreport for OH+PO-Orders and net position. The problem is that when you have a blank record for PO or OH it picks up the previous quantity. how can I make it not pick up a previous quantity if is blank to put a zero .

NEED to be this way                                        
example 1

OH YARDS
BLANK (NO RECORDS)

PO YARDS
BLANK (NO RECORDS

TOTAL ORDERS
250

NET POSIOTION
-250

example 2
OH YARDS
100

PO YARDS
BLANK (NO RECORDS

TOTAL ORDERS
250

NET POSIOTION
-150

example 3
OH YARDS
BLANK (NO RECORDS)

PO YARDS
250

TOTAL ORDERS
250

NET POSIOTION
0
 
example 4
OH YARDS
100

PO YARDS
200

TOTAL ORDERS
250

NET POSIOTION
50

sincerely,
rg



0
gueraf
Asked:
gueraf
  • 2
1 Solution
 
mlmccCommented:
WHere are you declaring and setting the shared variable?

What formulas are usig it?

mlmcc
0
 
guerafAuthor Commented:
for OH subnet report is shared numbervar faboh:= {@R1SAttl}*-1- Sum ({@CM}, {zzxssumh.COLOR_CODE})
and for po subnet report is shared numbervar fabwip:=Sum ({zzcordrd.wip_total}, {zzcordrd.color_code}) and for main report i created the following for OH NET,
{@faboh}-Sum ({@GTTLyds}, {zzbbommd.bd_color}) and for PO NET, {@fabwip}-Sum ({@GTTLyds}, {zzbbommd.bd_color}) , The problem is when you have no records for OH or PO is picks up the previous quantity and add it to the existing record ..

sincerley,
rg
0
 
mlmccCommented:
Are there groups in the report?

Why do you have @ in front of the shared variables?

Try something like this

In the main report header
Name - DeclVars
WhilePrintingRecords;
Shared NumberVar faboh := 0;
Shared NumberVar fabwip:= 0;

In the group header
Name - ResetVars
WhilePrintingRecords;
Shared NumberVar faboh ;
Shared NumberVar fabwip;

faboh := 0;
fabwip:= 0;


Subreports aadd WhilePrintingRecords;
YOur display formula add WhilePrintingRecords;


mlmcc
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now