Syntax Question

Hi,

I want to evaluate 2 things, "Area" and "SubsQuestions"

I need to know if Area = "Six" or Area = "Seven" AND SubsQuestions =
"Yes"

Is it

....... If Area = "Six" or Area = "Seven" AND SubsQuestions = "Yes"
Then

or

....... If Area = "Six" AND SubsQuestions = "Yes" or Area = "Seven" AND
SubsQuestions = "Yes" Then

To confirm...... Six and No is to be ignored
...... Seven and No is to be ignored
...... Seven and Yes will be dealt with
...... Six and Yes will be dealt with

I'm getting confused just typing it!

Thanks

Jon
J-P-W [ Sa, 17 November 2007 14:55 ] [ ID #1873166 ]

Re: Syntax Question

J-P-W wrote:
> Hi,
>
> I want to evaluate 2 things, "Area" and "SubsQuestions"
>
> I need to know if Area = "Six" or Area = "Seven" AND SubsQuestions =
> "Yes"
>
> Is it
>
> ...... If Area = "Six" or Area = "Seven" AND SubsQuestions = "Yes"
> Then
>
> or
>
> ...... If Area = "Six" AND SubsQuestions = "Yes" or Area = "Seven" AND
> SubsQuestions = "Yes" Then
>
Simple grouping

If Area = "Six" or (Area = "Seven" AND SubsQuestions ="Yes") then

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
reb01501 [ Sa, 17 November 2007 15:33 ] [ ID #1873167 ]

Re: Syntax Question

On 17 Nov, 14:33, "Bob Barrows [MVP]" <reb01... [at] NOyahoo.SPAMcom>
wrote:
> J-P-W wrote:
> > Hi,
>
> > I want to evaluate 2 things, "Area" and "SubsQuestions"
>
> > I need to know if Area = "Six" or Area = "Seven" AND SubsQuestions =
> > "Yes"
>
> > Is it
>
> > ...... If Area = "Six" or Area = "Seven" AND SubsQuestions = "Yes"
> > Then
>
> > or
>
> > ...... If Area = "Six" AND SubsQuestions = "Yes" or Area = "Seven" AND
> > SubsQuestions = "Yes" Then
>
> Simple grouping
>
> If Area = "Six" or (Area = "Seven" AND SubsQuestions ="Yes") then
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"- Hide quoted text -
>
> - Show quoted text -

Thanks.

So I can have:

If Area = ("Six" AND SubsQuestions = "Yes") or (Area = "Seven" AND
SubsQuestions = "Yes") Then
'Do stuff
Else
'Do not
End If

Cool :)
J-P-W [ Sa, 17 November 2007 16:31 ] [ ID #1873168 ]

Re: Syntax Question

J-P-W wrote:
>>
>> - Show quoted text -
>
> Thanks.
>
> So I can have:
>
> If Area = ("Six" AND SubsQuestions = "Yes") or (Area = "Seven" AND
> SubsQuestions = "Yes") Then
> 'Do stuff
> Else
> 'Do not
> End If
>
No, that is not possible - the first parenthesis is in the wrong location:
it needs to be infront of Area:

If (Area = "Six" AND SubsQuestions = "Yes") or _
(Area = "Seven" AND SubsQuestions = "Yes") Then

It's also too verbose. This does exactly the same thing (the commutative
property applies to boolean operators as well as arithmetic operators):

If (Area = "Six" or Area = "Seven") AND SubsQuestions = "Yes" Then

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
reb01501 [ Sa, 17 November 2007 17:21 ] [ ID #1873170 ]

Re: Syntax Question

On 17 Nov, 16:21, "Bob Barrows [MVP]" <reb01... [at] NOyahoo.SPAMcom>
wrote:
> J-P-W wrote:
>
> >> - Show quoted text -
>
> > Thanks.
>
> > So I can have:
>
> > If Area = ("Six" AND SubsQuestions = "Yes") or (Area = "Seven" AND
> > SubsQuestions = "Yes") Then
> > 'Do stuff
> > Else
> > 'Do not
> > End If
>
> No, that is not possible - the first parenthesis is in the wrong location:
> it needs to be infront of Area:
>
> If (Area = "Six" AND SubsQuestions = "Yes") or _
> (Area = "Seven" AND SubsQuestions = "Yes") Then
>
> It's also too verbose. This does exactly the same thing (the commutative
> property applies to boolean operators as well as arithmetic operators):
>
> If (Area = "Six" or Area = "Seven") AND SubsQuestions = "Yes" Then
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"

Whoops that was a typo, however, your last solution is the neatest -
thanks Bob

Jon
J-P-W [ Sa, 17 November 2007 17:53 ] [ ID #1873172 ]

Re: Syntax Question

"J-P-W" <jonpwebb [at] gmail.com> wrote in message
news:af03f197-91f9-49e5-874a-7393f2dd38da [at] e1g2000hsh.googleg roups.com...

[snip]

> On 17 Nov, 14:33, "Bob Barrows [MVP]" <reb01... [at] NOyahoo.SPAMcom>
> wrote:
> > If Area = "Six" or (Area = "Seven" AND SubsQuestions ="Yes") then

> So I can have:
>
> If Area = ("Six" AND SubsQuestions = "Yes") or (Area = "Seven" AND
> SubsQuestions = "Yes") Then
> 'Do stuff
> Else
> 'Do not
> End If

Yes; though your first set of parentheses is wrong.
Also, for readability, take a look at this:

If (SubsQuestions = "Yes" And Area = "Six") _
Or (SubsQuestions = "Yes" And Area = "Seven") Then
'Do stuff
Else
'Do not
End If
McKirahan [ Sa, 17 November 2007 18:53 ] [ ID #1873173 ]

Re: Syntax Question

McKirahan wrote on 17 nov 2007 in
microsoft.public.inetserver.asp.general:

> Yes; though your first set of parentheses is wrong.
> Also, for readability, take a look at this:
>
> If (SubsQuestions = "Yes" And Area = "Six") _
> Or (SubsQuestions = "Yes" And Area = "Seven") Then
> 'Do stuff
> Else
> 'Do not
> End If
>

I prefer for readability:

SQy = SubsQuestions = "Yes"
A6 = Area = "Six"
A7 = Area = "Seven"

If SQy AND (A6 OR A7) Then
'Do stuff
Else
'Do not
End If

or:

SQy = SubsQuestions = "Yes"
A6 = Area = "Six"
A7 = Area = "Seven"
A6orA7 = A6 OR A7

If SQy AND A6orA7 Then
'Do stuff
Else
'Do not
End If


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
exjxw.hannivoort [ Sa, 17 November 2007 19:45 ] [ ID #1873175 ]

Re: Syntax Question

"Evertjan." <exjxw.hannivoort [at] interxnl.net> wrote in message
news:Xns99EBC912567ACeejj99 [at] 194.109.133.242...
> McKirahan wrote on 17 nov 2007 in
> microsoft.public.inetserver.asp.general:
>
>> Yes; though your first set of parentheses is wrong.
>> Also, for readability, take a look at this:
>>
>> If (SubsQuestions = "Yes" And Area = "Six") _
>> Or (SubsQuestions = "Yes" And Area = "Seven") Then
>> 'Do stuff
>> Else
>> 'Do not
>> End If
>>
>
> I prefer for readability:
>
> SQy = SubsQuestions = "Yes"
> A6 = Area = "Six"
> A7 = Area = "Seven"
>
> If SQy AND (A6 OR A7) Then
> 'Do stuff
> Else
> 'Do not
> End If
>
> or:
>
> SQy = SubsQuestions = "Yes"
> A6 = Area = "Six"
> A7 = Area = "Seven"
> A6orA7 = A6 OR A7
>
> If SQy AND A6orA7 Then
> 'Do stuff
> Else
> 'Do not
> End If
>

To use a bit of both your suggestions
testQ = (SubsQuestions = "Yes")
test6 = (Area = "Six")
test7 = (Area = "Seven")

IF testQ then
IF test6 OR test7 THEN
'Do stuff
END IF
ELSE
'Do not
END IF





>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
me [ So, 18 November 2007 07:53 ] [ ID #1873627 ]

Re: Syntax Question

"ThatsIT.net.au" <me [at] thatsit> wrote in message
news:67AA2DFD-4317-4A5D-8BDD-14D45520ADDA [at] microsoft.com...
>
> "Evertjan." <exjxw.hannivoort [at] interxnl.net> wrote in message
> news:Xns99EBC912567ACeejj99 [at] 194.109.133.242...

[snip]

> >
> > I prefer for readability:
> >
> > SQy = SubsQuestions = "Yes"
> > A6 = Area = "Six"
> > A7 = Area = "Seven"
> >
> > If SQy AND (A6 OR A7) Then
> > 'Do stuff
> > Else
> > 'Do not
> > End If

[snip]

> To use a bit of both your suggestions
> testQ = (SubsQuestions = "Yes")
> test6 = (Area = "Six")
> test7 = (Area = "Seven")
>
> IF testQ then
> IF test6 OR test7 THEN
> 'Do stuff
> END IF
> ELSE
> 'Do not
> END IF

Sorry, that's not equivalent;you don't handle:
IF test6 OR test7 THEN's ELSE
McKirahan [ So, 18 November 2007 16:18 ] [ ID #1873628 ]

Re: Syntax Question

"McKirahan" <News [at] McKirahan.com> wrote in message
news:WpmdnWFbL48syt3anZ2dnUVZ_tuonZ2d [at] comcast.com...
> "ThatsIT.net.au" <me [at] thatsit> wrote in message
> news:67AA2DFD-4317-4A5D-8BDD-14D45520ADDA [at] microsoft.com...
>>
>> "Evertjan." <exjxw.hannivoort [at] interxnl.net> wrote in message
>> news:Xns99EBC912567ACeejj99 [at] 194.109.133.242...
>
> [snip]
>
>> >
>> > I prefer for readability:
>> >
>> > SQy = SubsQuestions = "Yes"
>> > A6 = Area = "Six"
>> > A7 = Area = "Seven"
>> >
>> > If SQy AND (A6 OR A7) Then
>> > 'Do stuff
>> > Else
>> > 'Do not
>> > End If
>
> [snip]
>
>> To use a bit of both your suggestions
>> testQ = (SubsQuestions = "Yes")
>> test6 = (Area = "Six")
>> test7 = (Area = "Seven")
>>
>> IF testQ then
>> IF test6 OR test7 THEN
>> 'Do stuff
>> END IF
>> ELSE
>> 'Do not
>> END IF
>
> Sorry, that's not equivalent;you don't handle:
> IF test6 OR test7 THEN's ELSE


yes it is,

first subquerys must be true or it fails, only if subquerys is true need we
test test6 or test7
me [ Fr, 23 November 2007 18:23 ] [ ID #1877316 ]

Re: Syntax Question

"ThatsIT.net.au" <me [at] thatsit> wrote in message
news:0B03165D-385B-490C-AB08-AB59F67BC46D [at] microsoft.com...
>
> "McKirahan" <News [at] McKirahan.com> wrote in message
> news:WpmdnWFbL48syt3anZ2dnUVZ_tuonZ2d [at] comcast.com...
> > "ThatsIT.net.au" <me [at] thatsit> wrote in message
> > news:67AA2DFD-4317-4A5D-8BDD-14D45520ADDA [at] microsoft.com...
> >>
> >> "Evertjan." <exjxw.hannivoort [at] interxnl.net> wrote in message
> >> news:Xns99EBC912567ACeejj99 [at] 194.109.133.242...
> >
> > [snip]
> >
> >> >
> >> > I prefer for readability:
> >> >
> >> > SQy = SubsQuestions = "Yes"
> >> > A6 = Area = "Six"
> >> > A7 = Area = "Seven"
> >> >
> >> > If SQy AND (A6 OR A7) Then
> >> > 'Do stuff
> >> > Else
> >> > 'Do not
> >> > End If
> >
> > [snip]
> >
> >> To use a bit of both your suggestions
> >> testQ = (SubsQuestions = "Yes")
> >> test6 = (Area = "Six")
> >> test7 = (Area = "Seven")
> >>
> >> IF testQ then
> >> IF test6 OR test7 THEN
> >> 'Do stuff
> >> END IF
> >> ELSE
> >> 'Do not
> >> END IF
> >
> > Sorry, that's not equivalent;you don't handle:
> > IF test6 OR test7 THEN's ELSE
>
>
> yes it is,
>
> first subquerys must be true or it fails, only if subquerys is true need
we
> test test6 or test7

Sorry, it's not.

If the second test fails you do not perform "Do not".

IF testQ then
IF test6 OR test7 THEN
'Do stuff
ELSE <= you don't allow for this
'Do not
END IF
ELSE
'Do not
END IF
McKirahan [ Fr, 23 November 2007 19:48 ] [ ID #1877319 ]

Re: Syntax Question

"McKirahan" <News [at] McKirahan.com> wrote in message
news:dYKdnbRn_v3avdranZ2dnUVZ_rWtnZ2d [at] comcast.com...
> "ThatsIT.net.au" <me [at] thatsit> wrote in message
> news:0B03165D-385B-490C-AB08-AB59F67BC46D [at] microsoft.com...
>>
>> "McKirahan" <News [at] McKirahan.com> wrote in message
>> news:WpmdnWFbL48syt3anZ2dnUVZ_tuonZ2d [at] comcast.com...
>> > "ThatsIT.net.au" <me [at] thatsit> wrote in message
>> > news:67AA2DFD-4317-4A5D-8BDD-14D45520ADDA [at] microsoft.com...
>> >>
>> >> "Evertjan." <exjxw.hannivoort [at] interxnl.net> wrote in message
>> >> news:Xns99EBC912567ACeejj99 [at] 194.109.133.242...
>> >
>> > [snip]
>> >
>> >> >
>> >> > I prefer for readability:
>> >> >
>> >> > SQy = SubsQuestions = "Yes"
>> >> > A6 = Area = "Six"
>> >> > A7 = Area = "Seven"
>> >> >
>> >> > If SQy AND (A6 OR A7) Then
>> >> > 'Do stuff
>> >> > Else
>> >> > 'Do not
>> >> > End If
>> >
>> > [snip]
>> >
>> >> To use a bit of both your suggestions
>> >> testQ = (SubsQuestions = "Yes")
>> >> test6 = (Area = "Six")
>> >> test7 = (Area = "Seven")
>> >>
>> >> IF testQ then
>> >> IF test6 OR test7 THEN
>> >> 'Do stuff
>> >> END IF
>> >> ELSE
>> >> 'Do not
>> >> END IF
>> >
>> > Sorry, that's not equivalent;you don't handle:
>> > IF test6 OR test7 THEN's ELSE
>>
>>
>> yes it is,
>>
>> first subquerys must be true or it fails, only if subquerys is true need
> we
>> test test6 or test7
>
> Sorry, it's not.
>
> If the second test fails you do not perform "Do not".
>
> IF testQ then
> IF test6 OR test7 THEN
> 'Do stuff
> ELSE <= you don't allow for this
> 'Do not
> END IF
> ELSE
> 'Do not
> END IF
>

OK I see what you mean, my error
me [ So, 25 November 2007 14:51 ] [ ID #1878455 ]
Webserver » microsoft.public.inetserver.asp.general » Syntax Question

Vorheriges Thema: MSXML installation help
Nächstes Thema: Cdonts