Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional formula, using Crystal 8.5 1

Status
Not open for further replies.

joybee36

Technical User
Feb 10, 2006
29
US
Hello!

Here's my (super simple) formula:
if {oeordlin_sql.item_no} startswith "3.10" then "Blue instruction sheet enclosed." else
if {oeordlin_sql.item_no} startswith "2.10" then "Yellow instruction sheet enclosed."

I need a third condition, where if an order contains more than one item, and just so happens to have items that start with both 2.1 and 3.1, I need this formula to return "Includes both blue and yellow instruction sheets".

I'm sure this is easy for y'all, but I'm stumped!

Thanks,
Joy
 
Actually this is tricky because you are mixing item level and order level conditions. It sounds like this should be all moved to the order level. First, create two new formulas:

//{@Cond 3.1}
if {oeordlin_sql.item_no} startswith "3.10" then 1 else 0

//{@Cond 2.1}
if {oeordlin_sql.item_no} startswith "2.10" then 1 else 0

Then your existing formula should be changed to:

If Sum ({@Cond 3.1}, {Your.OrderNoField}) > 0 and Sum ({@Cond 2.1}, {Your.OrderNoField}) > 0
then "Includes both blue and yellow instruction sheets"
else
If Sum ({@Cond 3.1}, {Your.OrderNoField}) > 0
then "Blue instruction sheet enclosed."
else
If Sum ({@Cond 2.1}, {Your.OrderNoField}) > 0
then "Yellow instruction sheet enclosed."
else ""

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
This worked perfectly, and I learned something!!! Thank you so much [hourglass]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top