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!

Nexted If C# 1

Status
Not open for further replies.

Hepburn

Technical User
Jul 4, 2007
9
US
Hi:

I'm using Crystal Reports X with Visual Studio 2005 and am programming in C# (which is new for me, I'm used to VB).

I have the following formula and would like to put "end if" where I've put the comments (see below). My problem is that it's not liking the syntax. Any ideas??

if {IndDecCert.CRED_TYPE_ID} = 7 then
if {IndDecCert.SPECIALTY} = 200 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
else if {IndDecCert.SPECIALTY} = 201 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else if {IndDecCert.SPECIALTY} = 202 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-2"
else if {IndDecCert.SPECIALTY} = 203 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-3"
else if {IndDecCert.SPECIALTY} = 204 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-4"
else if {IndDecCert.SPECIALTY} = 205 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-5"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
// I want to insert an end if here
else if {IndDecCert.CRED_TYPE_ID} = 35 then
if {IndDecCert.SPECIALTY} = 300 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else if {IndDecCert.SPECIALTY} = 600 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-2"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
// I want to insert an end if here
else if {IndDecCert.CRED_TYPE_ID} = 36 or
{IndDecCert.CRED_TYPE_ID} = 37 or {IndDecCert.CRED_TYPE_ID} = 38 then
if {IndDecCert.SPECIALTY} = 650 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
// I want to insert an end if here
else if {IndDecCert.CRED_TYPE_ID} = 16 then
if {IndDecCert.SPECIALTY} = 400 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
// I want to insert an end if here
else cstr({IndDecCert.CRED_TYPE_ID},"000")

Thanks much!
 
You need to add parens, as in:

if {IndDecCert.CRED_TYPE_ID} = 7 then
(
if {IndDecCert.SPECIALTY} = 200 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
else if {IndDecCert.SPECIALTY} = 201 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else if {IndDecCert.SPECIALTY} = 202 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-2"
else if {IndDecCert.SPECIALTY} = 203 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-3"
else if {IndDecCert.SPECIALTY} = 204 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-4"
else if {IndDecCert.SPECIALTY} = 205 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-5"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
)
else
if {IndDecCert.CRED_TYPE_ID} = 35 then
(
if {IndDecCert.SPECIALTY} = 300 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else if {IndDecCert.SPECIALTY} = 600 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-2"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
) else
if
(
{IndDecCert.CRED_TYPE_ID} = 36 or
{IndDecCert.CRED_TYPE_ID} = 37 or
{IndDecCert.CRED_TYPE_ID} = 38
) then
(
if {IndDecCert.SPECIALTY} = 650 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
) else
if {IndDecCert.CRED_TYPE_ID} = 16 then
(
if {IndDecCert.SPECIALTY} = 400 then
cstr({IndDecCert.CRED_TYPE_ID},"000") + "-1"
else cstr({IndDecCert.CRED_TYPE_ID},"000") + "-0"
) else
cstr({IndDecCert.CRED_TYPE_ID},"000")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top