Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

if / then with OR in the list not working?

LEGEND ,
Jan 14, 2008 Jan 14, 2008
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!



TOPICS
Server side applications
208
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 14, 2008 Jan 14, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 14, 2008 Jan 14, 2008
LATEST
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


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines