?
Solved

Nested IF statements in Crystal.

Posted on 2005-03-28
3
Medium Priority
?
7,085 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
[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
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.

777 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