Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Assistance needed in joining two sets of formulas. Post Reply Post New Topic
Author Message
bhaberman
Newbie
Newbie


Joined: 18 Aug 2010
Online Status: Offline
Posts: 4
Quote bhaberman Replybullet Topic: Assistance needed in joining two sets of formulas.
    Posted: 18 Aug 2010 at 5:17am

Hello!

 

I am running Macola ES as our ERP system.  I am trying to create a custom Order Entry bookings report.  I have created a formula that “tells” the report to make the unit price either a positive figure or negative figure based on its order type (Credit, Invoice, or Order) which changes based on order's invoice posting status.    

 

My problem is combining both sets of If statements.  Each set of three works on its own, just not together.  What command am I missing in between them?  I’ve tried OR, AND, ELSE.

 

Sorry if this is very basic.  Any help is appreciated!

 

if {oehdrhst_sql.orig_ord_type} = 'c' then {v_OEBOOKINGS.unit_price} * -1 else

if {oehdrhst_sql.orig_ord_type} = 'o' then {v_OEBOOKINGS.unit_price} * 1 else

if {oehdrhst_sql.orig_ord_type} = 'i' then {v_OEBOOKINGS.unit_price} * 1

 

(something missing here??)

 

if {oeordhdr_sql.ord_type} = 'c' then {v_OEBOOKINGS.unit_price} * -1 else

if {oeordhdr_sql.ord_type} = 'o' then {v_OEBOOKINGS.unit_price} * 1 else

if {oeordhdr_sql.ord_type} = 'i' then {v_OEBOOKINGS.unit_price} * 1

 
Thanks!
Brian
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 18 Aug 2010 at 5:47am
What is the issue, error message, incorrect results, etc.?
IP IP Logged
bhaberman
Newbie
Newbie


Joined: 18 Aug 2010
Online Status: Offline
Posts: 4
Quote bhaberman Replybullet Posted: 18 Aug 2010 at 5:57am
If I use "or" or "and" in between the three sets, I get "A boolean is required" after {v_OEBOOKINGS.unit_price} * 1
 
If I use Else in between the three sets, only the first three commands show in the data results.  Maybe I am missing parentheses and my formula is poorly written.
 
thanks,
brian


Edited by bhaberman - 18 Aug 2010 at 5:57am
IP IP Logged
bhaberman
Newbie
Newbie


Joined: 18 Aug 2010
Online Status: Offline
Posts: 4
Quote bhaberman Replybullet Posted: 18 Aug 2010 at 6:21am
I should add that if I make two separate formulas and drop both in the report, each shows me what I want to see.  It's when I try to accomplish this in ONE formula.

Edited by bhaberman - 18 Aug 2010 at 6:39am
IP IP Logged
Senthil Raj
Newbie
Newbie
Avatar

Joined: 02 Aug 2010
Location: India
Online Status: Offline
Posts: 27
Quote Senthil Raj Replybullet Posted: 18 Aug 2010 at 11:30pm
Originally posted by bhaberman

Hello!

 

I am running Macola ES as our ERP system.  I am trying to create a custom Order Entry bookings report.  I have created a formula that “tells” the report to make the unit price either a positive figure or negative figure based on its order type (Credit, Invoice, or Order) which changes based on order's invoice posting status.    

 

My problem is combining both sets of If statements.  Each set of three works on its own, just not together.  What command am I missing in between them?  I’ve tried OR, AND, ELSE.

 

Sorry if this is very basic.  Any help is appreciated!

 

if {oehdrhst_sql.orig_ord_type} = 'c' then {v_OEBOOKINGS.unit_price} * -1 else

if {oehdrhst_sql.orig_ord_type} = 'o' then {v_OEBOOKINGS.unit_price} * 1 else

if {oehdrhst_sql.orig_ord_type} = 'i' then {v_OEBOOKINGS.unit_price} * 1

 

(something missing here??)

 

if {oeordhdr_sql.ord_type} = 'c' then {v_OEBOOKINGS.unit_price} * -1 else

if {oeordhdr_sql.ord_type} = 'o' then {v_OEBOOKINGS.unit_price} * 1 else

if {oeordhdr_sql.ord_type} = 'i' then {v_OEBOOKINGS.unit_price} * 1

 
Thanks!
Brian


try like this

if {oehdrhst_sql.orig_ord_type} = 'c' and {oeordhdr_sql.ord_type} = 'c' then

{v_OEBOOKINGS.unit_price} * -1

else

{v_OEBOOKINGS.unit_price} * 1





IP IP Logged
bhaberman
Newbie
Newbie


Joined: 18 Aug 2010
Online Status: Offline
Posts: 4
Quote bhaberman Replybullet Posted: 19 Aug 2010 at 2:49am
Thanks!  That unfortunately still didn't work - only pulled in data from oehdrhst_sql.orig_ord_type
 
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.