Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Variables 4

Status
Not open for further replies.

JasGrand

Programmer
Jan 8, 2003
144
CA
Hello, I am using Crystal Reports v7.0 to create a report. On this report I have a function (in the detail section) that calculates how many Direct Type jobs there are and how many Indirect Type jobs. I have a function included in the detail section which follows:

NumberVar NumDirectJobCount;
NumberVar NumIndirectJobCount;
If {V_JOBS_CREATED.JOB_TYPE}[1 to 3] = "Dir" Then
NumDirectJobCount := NumDirectJobCount + {V_JOBS_CREATED.NUM_JOBS}
Else
NumIndirectJobCount := NumIndirectJobCount + {V_JOBS_CREATED.NUM_JOBS}

I need to display these variables in the report footer (where all my totals will be located). I need help on how to pass the value of the two variables above to another function so I can display them in the report footer.

Thanks,

Jason
 
in you formula replace :

NumberVar NumDirectJobCount;
NumberVar NumIndirectJobCount;

with :

Global NumberVar NumDirectJobCount;
Global NumberVar NumIndirectJobCount;

Then create a formula :

Global NumberVar NumDirectJobCount;

This will give you the value of the variable.
Hope it helps, keep me posted.

Reebo
Scotland (Going mad in the mist!)
 
Hello, for some reason it just gives me a 0.00 in the field. Any Suggestions?
 
As Reebo stated, add GLOBAL to the front of your variable declarations, the create formulas for each of the variables.

@DirectTotal
global NumberVar NumDirectJobCount;
NumDirectJobCount

@IndirectTotal
global NumberVar NumIndirectJobCount;
NumIndirectJobCount

Place these in the report footer.

If you need to display at the group level, create an initializing formula, as in:

@InitTotals
global NumberVar NumDirectJobCount:=0;
global NumberVar NumIndirectJobCount:=0;

Then you'd place this formula in the group header, the formula you have in the details, and the display as I just defined in the group footer.

-k
 
Synapse, you saved me.....Thank you.

I'd just like to congratulate you on being voted top tipster. [thumbsup2] Reebo
Scotland (Going mad in the mist!)
 
Hello thanks a lot for answering, like I said... I did that already and it's still showing me 0.00 in the other two fields(@DirTotal and @IndTotal). I just don't know why it's giving me the 0.00 when i know there is a number in the variable.

Thanks
 
Could I be doing something wrong?

This is the formula in the Details section:

Global NumberVar NumDirectJobCount;
Global NumberVar NumIndirectJobCount;
If {V_JOBS_CREATED.JOB_TYPE}[1 to 3] = "Dir" Then
NumDirectJobCount := NumDirectJobCount + {V_JOBS_CREATED.NUM_JOBS}
Else
NumIndirectJobCount := NumIndirectJobCount + {V_JOBS_CREATED.NUM_JOBS}


This is the formula for the @DirTotal function:
Global NumberVar NumDirectJobCount;
NumDirectJobCount

This is the formula for the @IndTotal function:
Global NumberVar NumIndirectJobCount;
NumIndirectJobCount

Any help is appreciated.


Thanks,

Jason
 
Add the evaluation constraint of "WhilePrintingRecords" to your totals formulas

WhilePrintingRecords;
Global NumberVar NumDirectJobCount;
NumDirectJobCount
Mike
 
Thanks Mike, you answered my question.

Is there a way to give points or anything in this forum?
 
Whoops........forgot that one. Reebo
Scotland (Going mad in the mist!)
 
That's what the
Code:
Mark this post as a 
helpful/expert post!

below each post (except your own) is for.




Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top