Print Page | Close Window

Formula Help

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12702
Printed Date: 03 May 2024 at 7:52am


Topic: Formula Help
Posted By: avaj
Subject: Formula Help
Date 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  
    ????



Replies:
Posted By: DBlank
Date 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"
)
)



Posted By: avaj
Date Posted: 24 Mar 2011 at 10:21am
You Totally Rock!!  Thanks



Print Page | Close Window