Solved

# Nested IF statements in Crystal.

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

Thank you for your help
0
Question by:campbel8
• 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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
###### Suggested Courses
Course of the Month8 days, 14 hours left to enroll

#### 621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.