Solved

# Nested IF statements in Crystal.

Posted on 2005-03-28
Medium Priority
7,085 Views
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

0
Question by:campbel8
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 34

Expert Comment

ID: 13646275
why not combine the 2 cases like...

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

LVL 42

Expert Comment

ID: 13646399
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
}

0

LVL 42

Accepted Solution

frodoman earned 1100 total points
ID: 13646431
Oops - too big of a hurry.  The correct syntax is actually:

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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
###### Suggested Courses
Course of the Month12 days, 12 hours left to enroll