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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF and Then functions

Status
Not open for further replies.

ARM129

Technical User
Dec 22, 2009
4
GB
hi,

i have been trying to modify a report at work to display either Pass or Fail for 2 date fields. I have the customer due date and then the actual date we booked out the order. I already have the following formulae:

{Part.Product_Grp} = {?Customer prefix} and
{Stock_Trans_Log.Tran_Type} = 12 and
{Stock_Trans_Log.Trans_Date} > {?Start Date} and
{Stock_Trans_Log.Trans_Date} < {?End Date} and
{SO Items.Due_Date} in {?Start Date} to {?End Date}

I would like to add something like:

if {Stock_Trans_Log.Tran_Type} >= {SO Items.Due_Date} then "fail" else "pass"

i am not sure the best way to add this to the above formulae, i already know that the above text wont work.

I would like to have a field on the report stating the pass or fail text.

Can anyone suggest anything?
 
Hi,
Don't confuse a formula to display a certain value and your record selection formula.
The first formula you listed is the record selection formula and is used to refine and limit the data returned to the report.
What you want is a formula that checks the values of the returned data and, based on some comparison, displays one of two to more choices.
I cannot tell what the test is from your second formula since it looks like you are comparing a numerical field to a Date and that won't work.
What determines pass or fail?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I think that's a typo--that you intended to compare two dates. Just add your corrected formula for pass/fail to the detail section.

-LB
 
both fields are date fields, i am trying to create a report for delivery performance. The report should compare the two dates and if the actual delivery date is after the due date it would state fail or similar text, if its equal to or less than the due date its ok.

Cheers,

Andy
 
if {Stock_Trans_Log.Trans_Date} >= {SO Items.Due_Date} then
"fail" else
"pass"

-LB
 
thanks guys.

My problem is knowing where to put that formula.

I havent ever had any training on crystal, they just expect me to pick it up lol!

i understand now the difference between a formula to sort out what data gets and then sorting the actual data, doing a comparison and offering either pass or fail. I just dont know where to put the formula. I am using Crystal version 9, can you give me an idiots walk through guide of where to add the forumla?

Thanks again in advance.

Cheers,

Andy
 
lbass, thanks a lot, its now just a case of getting the people here to use our SQL system correctly now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top