Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: IF Statement help. Post Reply Post New Topic
Author Message
mikevtss
Newbie
Newbie
Avatar

Joined: 04 Dec 2012
Online Status: Offline
Posts: 13
Quote mikevtss Replybullet Topic: IF Statement help.
     Posted: 04 Dec 2012 at 4:44pm
Hello all,
THe below if statement runs fine until it gets to the 5th "IF" to isolate the DUMPED PRODUCT CUSTOMER. It will not split this customer out and into its own group.. any ideas??  thank you.
 
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." and {s1_commodity.commodity_id} = "POTCHI" then "McCains Ballarat Chips" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." and {s1_commodity.commodity_id} = "POTSLI" then "McCains Ballarat Peel" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." and {s1_commodity.commodity_id} = "POTMAS" then "McCains Ballarat Slivers & Mash" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." and {s1_commodity.commodity_id} = "PIZBAZ" then "McCains Ballarat Pizza Bases" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." and {gsr_sales_analysis_v.customer} = "DUMPED PRODUCT - CUSTOMER" then "McCains Ballarat Dumped" else
if {gsr_sales_analysis_v.pc_full_name} = "Safries Pty Ltd" then "McCains Sth Australia" else
if {gsr_sales_analysis_v.pc_full_name} = "Ready Meals" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "Marvel Packers" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust)  Tasmania" then "McCains Tasmania" else {gsr_sales_analysis_v.pc_full_name}
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Dec 2012 at 3:25am
is the {s1_commodity.commodity_id} NULL for these last if options?
if so make sure that the formula option is set to use defualt values for nulls.
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 05 Dec 2012 at 5:23am
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." then
(if {s1_commodity.commodity_id} = "POTCHI" then "McCains Ballarat Chips" else
if {s1_commodity.commodity_id} = "POTSLI" then "McCains Ballarat Peel" else
if {s1_commodity.commodity_id} = "POTMAS" then "McCains Ballarat Slivers & Mash" else
if {s1_commodity.commodity_id} = "PIZBAZ" then "McCains Ballarat Pizza Bases"
else "McCains Ballarat Dumped")
else
if {gsr_sales_analysis_v.pc_full_name} = "Safries Pty Ltd" then "McCains Sth Australia" else
if {gsr_sales_analysis_v.pc_full_name} = "Ready Meals" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "Marvel Packers" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Tasmania" then "McCains Tasmania"
else {gsr_sales_analysis_v.pc_full_name}


------


try this

Edited by comatt1 - 05 Dec 2012 at 5:24am
IP IP Logged
mikevtss
Newbie
Newbie
Avatar

Joined: 04 Dec 2012
Online Status: Offline
Posts: 13
Quote mikevtss Replybullet Posted: 05 Dec 2012 at 10:41am
thanks.. tho it did not work.. could it be a relationship issue in my database?
 
as this Dumped Customer is invoiced one of these products (POTCHI,POTSLI etc) but we are grouping the product under the supplier McCains? and effectively trying to remove them from the group?
 
 
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 05 Dec 2012 at 10:49am
Is this a group header formula then?

Edited by comatt1 - 05 Dec 2012 at 10:51am
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 05 Dec 2012 at 10:54am
Originally posted by comatt1

if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Pty. Ltd." then
(if {s1_commodity.commodity_id} = "POTCHI" then "McCains Ballarat Chips" else
if {s1_commodity.commodity_id} = "POTSLI" then "McCains Ballarat Peel" else
if {s1_commodity.commodity_id} = "POTMAS" then "McCains Ballarat Slivers & Mash" else
if {s1_commodity.commodity_id} = "PIZBAZ" then "McCains Ballarat Pizza Bases" else
if {gsr_sales_analysis_v.customer} = "DUMPED PRODUCT - CUSTOMER" then "McCains Ballarat Dumped")

else
if {gsr_sales_analysis_v.pc_full_name} = "Safries Pty Ltd" then "McCains Sth Australia" else
if {gsr_sales_analysis_v.pc_full_name} = "Ready Meals" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "Marvel Packers" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Tasmania" then "McCains Tasmania"
else {gsr_sales_analysis_v.pc_full_name}



this could work
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Dec 2012 at 11:04am

I have a feeling this has to do with some null issue...

if you try using only
 
if {gsr_sales_analysis_v.pc_full_name} = "Safries Pty Ltd" then "McCains Sth Australia" else
if {gsr_sales_analysis_v.pc_full_name} = "Ready Meals" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "Marvel Packers" then "Ready Meals/Marvel" else
if {gsr_sales_analysis_v.pc_full_name} = "McCain Foods (Aust) Tasmania" then "McCains Tasmania"
else {gsr_sales_analysis_v.pc_full_name}
 
do these come in as expected?


Edited by DBlank - 05 Dec 2012 at 11:05am
IP IP Logged
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