Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Else IF Post Reply Post New Topic
Author Message
H0P5
Newbie
Newbie


Joined: 20 Jun 2007
Online Status: Offline
Posts: 14
Quote H0P5 Replybullet Topic: Else IF
    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 = {@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 = {@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 = {@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 = {@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 = {@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 = {@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
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.