Print Page | Close Window

Formula Help with Parens

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=22405
Printed Date: 02 May 2024 at 2:05pm


Topic: Formula Help with Parens
Posted By: BoltzGirl
Subject: Formula Help with Parens
Date Posted: 07 Aug 2017 at 11:12am
I am working on this formula and need some help.

If {AUTHS.ReferralType} = "DIA" and isnull ({V_SupplementalDataEndServiceDate.EndServiceDate})
else
If {AUTHS.ReferralType} like ["LTC", "PAL","HPC"] and isnull ({AUTHS.DischargeDate})
else isnull({Members.MBRNO}) and {AUTHS.ExpirationDate} > {@StartDefaultDate}
or not isnull({Members.TermDate})

I continue to get "The Keyword 'then' is missing" erro and it's highlighting the first "else" in line 3 above.

Extra eyes would be of great help and TIA.



Replies:
Posted By: kevlray
Date Posted: 07 Aug 2017 at 12:03pm
I am assuming that you are using Crystal format.  First off, you will need a THEN after your condition on each of the IF statements.  Also it is a little odd not to have something for the THEN, but just have a statement for the ELSE.  And your last ELSE looks like another conditional, but it is not preceded by an I.


Posted By: BoltzGirl
Date Posted: 07 Aug 2017 at 12:11pm
Sorry, I am using SAP Crystal Reports, 2013 Support Pack 7, version 14.1.7.1853 and changed the formula to include my then on each line, but now it is saying "Boolean is Required" and highlights the entire last section of my formula below where my IF starts.

{Members.CGRPID} like {?Health Plan} and
{Members.CIPACD} like {?IPA} and
{Members.CPLNTP} like {?LOB} and


If ({AUTHS.ReferralType}) = "DIA" and isnull ({V_SupplementalDataEndServiceDate.EndServiceDate})
then 'DIA'
else
If ({AUTHS.ReferralType}) like ["LTC", "PAL","HPC"] and isnull ({AUTHS.DischargeDate})
then 'LTC'
else
If isnull({Members.MBRNO}) and {AUTHS.ExpirationDate} > {@StartDefaultDate}
or not isnull({Members.TermDate})
then 'MBR'


Posted By: kevlray
Date Posted: 08 Aug 2017 at 4:08am
Looks like you are doing the formula in the select expert (used for filtering).  Thus it wants a true/false result from the formula.

Not sure what you are trying to accomplish with this formula other to display a value based on some conditions.


Posted By: BoltzGirl
Date Posted: 08 Aug 2017 at 4:51am
Yes, that is where I have it. Your comment just made me think and realize what I am doing wrong. LOL thank you! I need to create a couple of formulas for these specific records I am looking for, then use my formulas in my selection criteria. Did that and now it's working :-)



Print Page | Close Window