?
Solved

Nested IF statements in Crystal.

Posted on 2005-03-28
3
Medium Priority
?
7,229 Views
Last Modified: 2010-10-05
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
Comment
Question by:campbel8
  • 2
3 Comments
 
LVL 34

Expert Comment

by:Brian Crowe
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

by:frodoman
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

by:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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…

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.

Join & Ask a Question