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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formula problems 1

Status
Not open for further replies.

wreiche

IS-IT--Management
Sep 28, 2006
36
CA
I'm using crystal reports XI and am trying to implement a function. Is there an if/endif construct so that I can include more than one statement following my if statement? In the example below, I have to repeat the if statement twice, once for each statement I would like executed.

WhilePrintingRecords;
Global numberVar AccCnt;
Global numberVar AccTm;
Global stringVar LastId;

if {Sheet2_Print_Area.Region} <> LastId then
AccCnt = 0;
if {Sheet2_Print_Area.Region} <> LastId then
AccTm = 0;

LastId := {Sheet2_Print_Area.Region_Name};
 
You could switch to Basic syntax and use it as follows:

Code:
WhilePrintingRecords
Global AccCnt as Number
Global AccTm as number
Global LastId as string

if {Sheet2_Print_Area.Region} <> LastId then
    AccCnt = 0
    AccTm = 0
end if

LastId = {Sheet2_Print_Area.Region_Name}

formula = LastId

Patrick
 
No idea what you mean here.

Try:

WhilePrintingRecords;
Global numberVar AccCnt;
Global numberVar AccTm;
Global stringVar LastId;
if {Sheet2_Print_Area.Region} <> LastId then
(
AccCnt := 0;
AccTm := 0
);
LastId := {Sheet2_Print_Area.Region_Name};

-k
 
Cool, didn't realise you could combine statements in crystal syntax by wrapping them in brackets, learn something new every day!

Thx synapsevampire !

 
SV,
That's what I was trying to do. Thanks. The two CR books I am using for reference do not provide a lot of information on formulas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top