Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Formula Help Post Reply Post New Topic
Author Message
avaj
Newbie
Newbie


Joined: 26 Sep 2007
Online Status: Offline
Posts: 30
Quote avaj Replybullet Topic: Formula Help
    Posted: 24 Mar 2011 at 9:45am
Hi all,
  I am using Crystal 2008.  I am using a parameter based formula for record selection.  I want the last option to basically say, if "none of the above".  Any idea how to make the last one give me everything else that does not fit the other categories?
 
I tried just using the field name but that gives me an error.  If I leave the last if statement off, I get no records.  If I use "true" then I get all records which is covered by the first option.
 
If {?Merchants} = "0" then
  true
else
  if {?Merchants} = "1" then 
    ({TRANSIT_FACILITY.SHORT_DESC} startswith "CVS") 
else
  if {?Merchants} = "2" then 
    ({TRANSIT_FACILITY.SHORT_DESC} startswith "Giant") 
else
  if {?Merchants} = "3" then 
    ({TRANSIT_FACILITY.FACID} in [6022, 5055, 6023, 6024, 6028])
else
  if {?Merchants} = "4" then 
    ({TRANSIT_FACILITY.SHORT_DESC} startswith "PRTC") 
else
  if {?Merchants} = "5" then 
    ({TRANSIT_FACILITY.SHORT_DESC}  like "*Commuter*") 
else
  if {?Merchants} = "6" then 
    ({TRANSIT_FACILITY.SHORT_DESC} startswith "Zodiac") 
else
  if {?Merchants} = "7" then  
    ????
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Mar 2011 at 10:13am

don't use if -then
use or's
({?Merchants} = "0" )
or
({?Merchants} = "1" and {TRANSIT_FACILITY.SHORT_DESC} startswith "CVS")
or
({?Merchants} = "2" and {TRANSIT_FACILITY.SHORT_DESC} startswith "Giant") 
or
 ({?Merchants} = "3" and {TRANSIT_FACILITY.FACID} in [6022, 5055, 6023, 6024, 6028])
or
({?Merchants} = "4" and {TRANSIT_FACILITY.SHORT_DESC} startswith "PRTC")
or
 ({?Merchants} = "5" and {TRANSIT_FACILITY.SHORT_DESC}  like "*Commuter*") 
or
({?Merchants} = "6" and {TRANSIT_FACILITY.SHORT_DESC} startswith "Zodiac") 
or
({?Merchants} = "7" and
(
NOT(

{TRANSIT_FACILITY.SHORT_DESC} startswith "CVS"
or
{TRANSIT_FACILITY.SHORT_DESC} startswith "Giant" 
or
{TRANSIT_FACILITY.FACID} in [6022, 5055, 6023, 6024, 6028]
or
{TRANSIT_FACILITY.SHORT_DESC} startswith "PRTC"
or
{TRANSIT_FACILITY.SHORT_DESC}  like "*Commuter*" 
or
{TRANSIT_FACILITY.SHORT_DESC} startswith "Zodiac"
)
)

IP IP Logged
avaj
Newbie
Newbie


Joined: 26 Sep 2007
Online Status: Offline
Posts: 30
Quote avaj Replybullet Posted: 24 Mar 2011 at 10:21am
You Totally Rock!!  Thanks
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.