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

Problem with If/Then/Else If

Status
Not open for further replies.

dwade

MIS
Sep 27, 2002
1
US
I'm trying to get a 'total due' to show up on a renewal form based on some membership parameters. The formula I currently have works for the first condition, but shows nothing for the following ones. Using Crystal 7.0 to pull from MS SQL. Thanks for any help.

if (({FASS_MEMBERSHIP.ASAS_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ASAS_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ASAS_STATUS}= 'A' )
and ({FASS_MEMBERSHIP.ADSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ADSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ADSA_STATUS}= 'A' )
and ({FASS_MEMBERSHIP.PSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.PSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.PSA_STATUS}= 'A' )) then '$340.00'
//Member of all 3
else if (({FASS_MEMBERSHIP.ASAS_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ASAS_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ASAS_STATUS}= 'A' )
and ({FASS_MEMBERSHIP.ADSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ADSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ADSA_STATUS}= 'A' )) then '$220.00'
//Member of 1st and 2nd
else if (({FASS_MEMBERSHIP.ASAS_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ASAS_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ASAS_STATUS}= 'A' )
and ({FASS_MEMBERSHIP.PSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.PSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.PSA_STATUS}= 'A' )) then '$230.00'
//Member of 1st and 3rd
else if (({FASS_MEMBERSHIP.ADSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ADSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ADSA_STATUS}= 'A' )
and ({FASS_MEMBERSHIP.PSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.PSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.PSA_STATUS}= 'A' )) then '$230.00'
//Member of 2nd and 3rd
else if (({FASS_MEMBERSHIP.ASAS_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ASAS_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ASAS_STATUS}= 'A' )
or ({FASS_MEMBERSHIP.ADSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.ADSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.ADSA_STATUS}= 'A' )) then '$110.00'
//Member of either 1st or 2nd
else if (({FASS_MEMBERSHIP.PSA_MEMBER_TYPE} in ('PROF')
and {FASS_MEMBERSHIP.PSA_PAID_THRU}>={?PaidThru}
and {FASS_MEMBERSHIP.PSA_STATUS}= 'A' )) then '$120.00'
//Member of 3rd
else ' '
//Non-Member

Thanks again.
 
I think you're expecting each else to be an else clause of the first if, when in reality, as each if can only have one else, after the first else, every subsequent else is an else of the most recent if. (That's not the kind of sentence I should have to type on a Friday evening...)

I'm going to suggest that you take out the elses, thus separating each if into an independant statement. Replace each else with a ';' and a carriage return, with the exception of the 'Non Member' else.

Then sit back and see what you get.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top