Print Page | Close Window

If Then Else - Not Working

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=22390
Printed Date: 04 May 2024 at 7:09am


Topic: If Then Else - Not Working
Posted By: BoltzGirl
Subject: If Then Else - Not Working
Date Posted: 18 Jul 2017 at 11:30am
I have this formula that I am trying and have moved my parens many different ways, yet I continue to get an error that says The ) is missing and it highlights the 2nd If line (AUTHS.

If {AUTHS.ReferralType} = "HPC" and ({AuthStatusMaster.AuthStatus}) = "AHPCE" Then "HPC New"
Else
If (AUTHS.ReferralType} = "HPC" and ({AUTHS.Status}) = "Pended" Then "HPC Ongoing"
Else
If {AUTHS.ReferralType} = "HPC" and ({AuthStatusMaster.AuthStatus}) = "AHPCC" Then "HPC Completed"

What am I missing?

TIA



Replies:
Posted By: DBlank
Date Posted: 18 Jul 2017 at 12:26pm
These are all AND conditions so you should not need any parenthesis in that code

If {AUTHS.ReferralType} = "HPC" and {AuthStatusMaster.AuthStatus} = "AHPCE" Then "HPC New"
Else
If (AUTHS.ReferralType} = "HPC" and {AUTHS.Status} = "Pended" Then "HPC Ongoing"
Else
If {AUTHS.ReferralType} = "HPC" and {AuthStatusMaster.AuthStatus} = "AHPCC" Then "HPC Completed"


Posted By: BoltzGirl
Date Posted: 18 Jul 2017 at 12:44pm
I just realized my silly mistake and that I need some new glasses or a larger monitor. When I copied your formula into my report, I still got the same error and realized it is a ( in that 2nd line rather than the {.

My fault complete, apologies!!!!    

Thanks for the assistance.


Posted By: lockwelle
Date Posted: 21 Jul 2017 at 11:12am
Just as an added note...If none of the conditions are met, what is returned? I think it is an empty string.
A final ELSE statement with an message might help debug. Of course if you want it be empty if none of the conditions are met, then it is perfect.



Print Page | Close Window