Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Cannot pass global value Post Reply Post New Topic
Author Message
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Topic: Cannot pass global value
     Posted: 12 Oct 2010 at 2:02pm

Hello

 

I have created 2 formulas (below).  The first formula is meant to pass a variable number to formula 2 (section in red ***)

The problem is that I do not know how to call the value (number) form formula 1 into formula 2.

 

I need to keep these separate because once the value is passed I will need to insert a summary on formula 2.

 

I am desperate for any assistance…

 

Regards,
DespinaDead

 

1.

whileprintingrecords;

global numbervar subtractWRKPEN;

subtractWRKPEN :=  SUM ({@OA_Wrk}, ({Command.EMPLOYEE_HISTNAME}))-SUM ({@OA_PS},
({Command.EMPLOYEE_HISTNAME}))

 

 

2.


whilereadingrecords;
NumberVar  RTotal;


If {Command.SUM(WRKD_MINUTES)}= 1 and {Command.UNIT} > '0:00'  Then
RTotal :=
    ToNumber({Command.UNIT})

 

else if {@Grouping_5}='Casual Loading 22.5%' Then

RTotal := ****


ELSE
RTotal :=
    {Command.SUM(WRKD_MINUTES)}

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 Oct 2010 at 3:25am
in 2 add:

global numbervar subtractWRKPEN;

 
then use it as desired.
 
HTH
IP IP Logged
Despina
Newbie
Newbie


Joined: 30 Mar 2010
Location: Australia
Online Status: Offline
Posts: 31
Quote Despina Replybullet Posted: 13 Oct 2010 at 12:05pm
Hi
 
 
Thanks for your update - I tried to add the global numbervar subtracctWRKPEN but it did not work - it returned 0 when I said RTotal : =subtractWRKPEN. 
I think this is because of the order of execution of each formula.  Do you have any idea how I can get around this?
 
Regards,
Despina
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Oct 2010 at 3:27am
is 1 called before 2?
just to check your logic, you can create a new formula to display just the global variable and see what it is returning...that is the next step that I would take...just to prove to myself where the issue is or isn't.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum