Click to See Complete Forum and Search --> : Else If Statements


WandaLL
10-06-2004, 07:11 PM
:confused:

I have just totally confused myself with the else if, etc statements. I have a group called OPA. I wanted this group to see different information. One group will see information based on their cost center which is contained in a text file. If the individuals in this group cost center is not in this text file, then they will see something else. I have about 75 other groups and everything has been working okay until I added the below group. I've been fooling with this for about a week now. Any help would be appreciated...

This is the cost center code:
<%
'this include file defines the lists of cost centers for India (Bangalore)
'modify the if conditions in this file when cost centers change, are added, or removed

if costCtr = "01021" or costCtr = "08813" or costCtr = "08941" or costCtr = "08942" or costCtr = "08943" or costCtr = "08944" then
practice = "OPA"
end if

%>


This is my else if then statement:

<% elseif UCase(busDiv) = "OPA-OPSAD" then %>
<iframe width="300" height="155" src="http://fescodoc.fmr.com/Get/File-70490/fesco.htm"></iframe>
<% elseif UCase(busDiv) = "OPA-OPSAD" then %>
<!-- #INCLUDE file="CostCenterBangalore.txt" -->
<% elseif UCase(practice) = "OPA" then %>
<iframe width="300" height="155" src="http://fescodoc.fmr.com/Get/File-471727/Bangalore_Associates_Dynamic_Content.htm"></iframe>
<% end if %>

JPnyc
10-06-2004, 07:21 PM
.

buntine
10-06-2004, 11:05 PM
Im not sure if I understood your problem completely, but I think you have placed an 'end if' in their when one was not needed.

<%
If costCtr = "01021" or costCtr = "08813" or costCtr = "08941" or costCtr = "08942" or costCtr = "08943" or costCtr = "08944" Then %>
practice = "OPA"
<% Elseif UCase(busDiv) = "OPA-OPSAD" Then %>
<iframe width="300" height="155" src="http://fescodoc.fmr.com/Get/File-70490/fesco.htm"></iframe>
<% Elseif UCase(busDiv) = "OPA-OPSAD" Then %>
<!-- #INCLUDE file="CostCenterBangalore.txt" -->
<% Elseif UCase(practice) = "OPA" Then %>
<iframe width="300" height="155" src="http://fescodoc.fmr.com/Get/File-471727/Bangalore_Associates_Dynamic_Content.htm"></iframe>
<% End If %>

Also, DUNSEL, did you make a mistake in your post? Shall I remove it?

Regards.

WandaLL
10-07-2004, 12:23 PM
This is what I'm trying to do:

1. I have one group
2. When they come to the website, I want them to see different information based on their cost centers.
3. Those in the group who's cost center is in the txt file would see one thing.
4. Those in the group who's cost center is NOT in the txt file would see something else.

I've tried everything. This piece of code is part of similar code for about 75 other groups.

I have tried everything...:(

chrismartz
10-07-2004, 02:11 PM
Originally posted by buntine


<%
If costCtr = "01021" or costCtr = "08813" or costCtr = "08941" or costCtr = "08942" or costCtr = "08943" or costCtr = "08944" Then %>
practice = "OPA"
<% Elseif UCase(busDiv) = "OPA-OPSAD" Then %>
<iframe width="300" height="155" src="http://fescodoc.fmr.com/Get/File-70490/fesco.htm"></iframe>
<% Elseif UCase(busDiv) = "OPA-OPSAD" Then %>
<!-- #INCLUDE file="CostCenterBangalore.txt" -->
<% Elseif UCase(practice) = "OPA" Then %>
<iframe width="300" height="155" src="http://fescodoc.fmr.com/Get/File-471727/Bangalore_Associates_Dynamic_Content.htm"></iframe>
<% End If %>
Wandall, what exactly is the problem...are you getting any errors or is just nothing showing?

WandaLL
10-07-2004, 04:34 PM
I can't get separate information/links to show everybody in the group gets the same thing instead of part getting one links and the other part getting another link.

Hope that makes sense.