Link to home
Start Free TrialLog in
Avatar of campbel8
campbel8

asked on

Nested IF statements in Crystal.

Hello...

I need to setup a formula in which I need to first check to see if a value is within a given range it will then perform some parsing and determine if the value is within another range.  If it is, I need to spit the value out, otherwise I need to return zero.  Please trust me on the logic I need to perform, I just really need to know the syntax of how to perform something like the following in Crystal.

IF (accountID in [1 to 10]) THEN
  companyNum = Right(accountID, 2)
  IF (companyNum = previouslyDefinedValue) THEN
    amount
  else
    0
ELSE
  0

Thank you for your help
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

why not combine the 2 cases like...

IF (accountID in [1 to 10]) And (Right(accountID, 2)= previouslyDefinedValue) THEN
    amount
ELSE
  0
I agree with above, but if you need the syntax you requested:

if accountID in [1 to 10] then
{
   companyNum = Right(accountID,2)
   if companyNum = previouslyDefinedValue then
      amount
   else
      0
}
else
{
   0
}


ASKER CERTIFIED SOLUTION
Avatar of frodoman
frodoman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial