Print Page | Close Window

Else IF

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1864
Printed Date: 17 May 2024 at 6:57pm


Topic: Else IF
Posted By: H0P5
Subject: Else IF
Date Posted: 11 Dec 2007 at 6:01am
Hi There
 
I have the following formula in using Basic Syntax:
 
if {RPT_Hours__Records___Additional_Comments.Agency} like "*Named*" then formula = mailto:%7b@ExtActualPay - {@ExtActualPay } else if {RPT_Hours__Records___Additional_Comments.Project Name} = "Streamline" and {RPT_Hours__Records___Additional_Comments.Job Role} = "Learning Consultant" and {RPT_Hours__Records___Additional_Comments.Band Equiv} = 5 then formula = 62.50 else formula = {RPT_Hours__Records___Additional_Comments.MRP Catalogue Rate (Hourly £) Taken from MRP Catalogue}
if {RPT_Hours__Records___Additional_Comments.Agency} like "*Named*" then formula = mailto:%7b@ExtActualPay - {@ExtActualPay } else if {RPT_Hours__Records___Additional_Comments.Project Name} = "Streamline" and {RPT_Hours__Records___Additional_Comments.Job Role} = "Learning Consultant" and {RPT_Hours__Records___Additional_Comments.Band Equiv} = 6 then formula = 68.75 else formula = {RPT_Hours__Records___Additional_Comments.MRP Catalogue Rate (Hourly £) Taken from MRP Catalogue}
if {RPT_Hours__Records___Additional_Comments.Agency} like "*Named*" then formula = mailto:%7b@ExtActualPay - {@ExtActualPay } else if {RPT_Hours__Records___Additional_Comments.Project Name} = "Streamline" and {RPT_Hours__Records___Additional_Comments.Job Role} = "Learning Consultant" and {RPT_Hours__Records___Additional_Comments.Band Equiv} = 7 then formula = 68.75 else formula = {RPT_Hours__Records___Additional_Comments.MRP Catalogue Rate (Hourly £) Taken from MRP Catalogue}
if {RPT_Hours__Records___Additional_Comments.Agency} like "*Named*" then formula = mailto:%7b@ExtActualPay - {@ExtActualPay } else if {RPT_Hours__Records___Additional_Comments.Project Name} = "Streamline" and {RPT_Hours__Records___Additional_Comments.Job Role} = "Learning Consultant" and {RPT_Hours__Records___Additional_Comments.Band Equiv} = 8 then formula = 75.00 else formula = {RPT_Hours__Records___Additional_Comments.MRP Catalogue Rate (Hourly £) Taken from MRP Catalogue}
if {RPT_Hours__Records___Additional_Comments.Agency} like "*Named*" then formula = mailto:%7b@ExtActualPay - {@ExtActualPay } else if {RPT_Hours__Records___Additional_Comments.Project Name} = "Streamline" and {RPT_Hours__Records___Additional_Comments.Job Role} = "Learning Consultant" and {RPT_Hours__Records___Additional_Comments.Band Equiv} = 9 then formula = 75.00 else formula = {RPT_Hours__Records___Additional_Comments.MRP Catalogue Rate (Hourly £) Taken from MRP Catalogue}
if {RPT_Hours__Records___Additional_Comments.Agency} like "*Named*" then formula = mailto:%7b@ExtActualPay - {@ExtActualPay } else if {RPT_Hours__Records___Additional_Comments.Project Name} like "*Tinker*" or {RPT_Hours__Records___Additional_Comments.Project Name} = "Semaphore" then formula = {RPT_Hours__Records___Additional_Comments.MRP Catalogue Rate (Hourly £) Taken from MRP Catalogue}/100*110
 
 
 
sorry its so long winded!
essentially the problem is the formula will only address 2 of my clauses..
 
for example:
1 else if 2 else if 3
 
It will work on 1 or 2, but never all 3.
If I toggle out anyone of these 3 statements if works for two, never three.. can anyone help at all?


-------------
H0P5



Replies:
Posted By: BrianBischof
Date Posted: 11 Dec 2007 at 11:40am
Well, this is much too long for me to analyze, but one obvious concern is that there are no parentheses. Using parentheses around each block of conditions makes it easier for CR to know what you intend to do as well as making it easier to find problems. Plus, indenting code makes it easier to debug as well. Right now it just looks a million If-Thens thrown together in a big pile. Proper use of line breaks, tabs, and parentheses would definitely help clear things up.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window