Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: If Then Else - Not Working Post Reply Post New Topic
Author Message
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Topic: If Then Else - Not Working
    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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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"
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet 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.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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.
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.016 seconds.