Skip to main content
Inspiring
January 15, 2008
Question

if / then with OR in the list not working?

  • January 15, 2008
  • 2 replies
  • 230 views
I can't figure out why this doesn't work:

<% if Session("svUserID") = (1768 or 1919 or 188 or 566) then %>

If I write it like this, none of these IDs are recognized and my "then"
doesn't run.


If I write:

<% if Session("svUserID") = 1768 or 1919 or 188 or 566 then %>

then it seems like ANY UserID gets what follows the "then" ... even if it's
not one in the list!

Is it my syntax??

Help!



This topic has been closed for replies.

2 replies

Inspiring
January 15, 2008
Thanks much. I'm surprised there isn't a less "wordy" way to write that.

I appreciate the help - it works perfectly.



"danilocelic AdobeCommunityExpert" <danilo@shimmerphase.com> wrote in
message news:fmhh3g$e4v$1@forums.macromedia.com...
> HX wrote:
>> If I write:
>>
>> <% if Session("svUserID") = 1768 or 1919 or 188 or 566 then %>
>>
>> then it seems like ANY UserID gets what follows the "then" ... even if
>> it's not one in the list!
>>
>> Is it my syntax??
>
> I assume that you mean to do the following (in pseudo code):
> if session value = 1768 or session value = 1919 or session value = 188 or
> session value = 566 then
>
> If that is the case, then yes it is your syntax. It looks like you're
> using ASP VBScript, in that case to do what you want you'd need to do
> this:
> <% if Session("svUserID") = 1768 or Session("svUserID") = 1919 or
> Session("svUserID") = 188 or Session("svUserID") = 566 then %>
>
>
> --
> Danilo Celic
> | Extending Knowledge Daily : http://CommunityMX.com/
> | Adobe Community Expert


Inspiring
January 15, 2008
HX wrote:
> If I write:
>
> <% if Session("svUserID") = 1768 or 1919 or 188 or 566 then %>
>
> then it seems like ANY UserID gets what follows the "then" ... even if it's
> not one in the list!
>
> Is it my syntax??

I assume that you mean to do the following (in pseudo code):
if session value = 1768 or session value = 1919 or session value = 188 or session value = 566 then

If that is the case, then yes it is your syntax. It looks like you're using ASP VBScript, in that case to do what you want you'd need to do this:
<% if Session("svUserID") = 1768 or Session("svUserID") = 1919 or Session("svUserID") = 188 or Session("svUserID") = 566 then %>


--
Danilo Celic
| Extending Knowledge Daily : http://CommunityMX.com/
| Adobe Community Expert