Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Newbie needs help with Formula Post Reply Post New Topic
Author Message
BunmiA
Newbie
Newbie
Avatar

Joined: 11 Apr 2008
Location: United States
Online Status: Offline
Posts: 1
Quote BunmiA Replybullet Topic: Newbie needs help with Formula
     Posted: 11 Apr 2008 at 6:49am

I'll appreciate any help with the formula below in CR XI. Most part of the formula executes okay except for When PAYMENT_METHOD.LIST_ITEM_NAME = 'Insurance' and PATIENT_INSURANCE.BENEFITS_ID is either 1 or 2.

Any assistance will be appreciated.
 
Thanks.
 
If IsNull({PAYMENT_METHOD.LIST_ITEM_NAME}) and IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and IsNull({BENEFITS.LIST_ITEM_NAME}) and IsNull({CUSTOMERS.PRIMARY_BENEFITS_ID})
   Then 'Unkn'
else If ({PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance') and IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and IsNull({BENEFITS.LIST_ITEM_NAME}) and IsNull({CUSTOMERS.PRIMARY_BENEFITS_ID}))
    Then 'Unkn'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance')   and {CUSTOMERS.PRIMARY_BENEFITS_ID} = 2
    Then 'In/OutN'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance')   and {CUSTOMERS.PRIMARY_BENEFITS_ID} = 1
    Then 'In'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance')   and {PATIENT_INSURANCE.BENEFITS_ID} = 2
    Then 'In/OutN'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance')   and {PATIENT_INSURANCE.BENEFITS_ID} = 1
    Then 'In'
else If (not IsNull({PATIENT_INSURANCE.BENEFITS_ID})  and {PATIENT_INSURANCE.BENEFITS_ID}=3)
    Then 'Cash'
Else If not IsNull({PAYMENT_METHOD.LIST_ITEM_NAME}) and {PAYMENT_METHOD.LIST_ITEM_NAME} like ['Cash*','Financ*','Capit*']
    Then 'Cash'
Else If not IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and {PATIENT_INSURANCE.BENEFITS_ID}=1
    Then 'In'
Else If ({PATIENT_INSURANCE.BENEFITS_ID}=2 or  {CUSTOMERS.PRIMARY_BENEFITS_ID}=2)
    Then 'In/OutN'
Else If not IsNull({BENEFITS.LIST_ITEM_NAME}) and {BENEFITS.LIST_ITEM_NAME} = trim('In Network')
    Then 'In'
Else If not IsNull({BENEFITS.LIST_ITEM_NAME}) and {BENEFITS.LIST_ITEM_NAME} = trim('In / Out of Network')
    Then 'In/OutN'
Else If not IsNull({BENEFITS.LIST_ITEM_NAME}) and {BENEFITS.LIST_ITEM_NAME} = trim('Exclusion')
    Then 'Cash'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance') and IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and IsNull({BENEFITS.LIST_ITEM_NAME}) and {CUSTOMERS.PRIMARY_BENEFITS_ID} = 2
    Then 'In/OutN'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance') and IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and IsNull({BENEFITS.LIST_ITEM_NAME}) and {CUSTOMERS.PRIMARY_BENEFITS_ID} = 1
    Then 'In'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance') and IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and IsNull({BENEFITS.LIST_ITEM_NAME}) and {CUSTOMERS.PRIMARY_BENEFITS_ID} = 3
    Then 'Cash'
Else If {PAYMENT_METHOD.LIST_ITEM_NAME}=trim('Insurance') and IsNull({PATIENT_INSURANCE.BENEFITS_ID}) and IsNull({BENEFITS.LIST_ITEM_NAME}) and IsNull({CUSTOMERS.PRIMARY_BENEFITS_ID})
    Then 'Unkn'
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 11 Apr 2008 at 8:49am
I don't know how to help you with this one. You clearly have a solid understanding of how the If Then Else statement works since this is a complex piece of code you wrote. Also, the majority of it works fine so you also have the syntax correct for it. The part you are concerned about has the same syntax as everything else, so that should be fine as well.

If this were my report, I would first get rid of everything that does work and just leave the part that doesn't work. This will isolate the problem and simplify it greatly. Then I would create formulas which print out the values of the fields being tested and right next to it print the output of the If statement. This would let me see the exact data being worked with and play with the structure of the If statement to get it to produce the results I want.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
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