Adobe Dreamweaver Forums



Last 10 THreads :         Dragging components (Last Post : hsfrey - Replies : 4 - Views : 5 )           »          Charts: Gap between Vertical Axis and the chart area (Last Post : flexisawesome - Replies : 0 - Views : 1 )           »          Pop up window using AS3 (Last Post : retsnomrev - Replies : 3 - Views : 4 )           »          can a combobox contain two different list seperated byvdivider ? (Last Post : v-Jay - Replies : 2 - Views : 6 )           »          Refreshing xml data in flex (Last Post : PiyushGiri01 - Replies : 2 - Views : 19 )           »          Integrating Captivate with ASP - SQL? (Last Post : bikturisint - Replies : 19 - Views : 131 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Cold Fusion > Getting Started
 
Tags:



Reply
  #1 (permalink)  
Old 11-21-2008, 07:04 PM
idesdema
 
Posts: n/a
Diggs:
Default cfif

I don't understand the logic here...

<cfif #page_indicator_a# NEQ '1' OR #page_indicator_a# NEQ '2'>

won't work but this will

<cfif #page_indicator_a# NEQ '1'>
<cfif #page_indicator_a# NEQ '2'>


Can someone tell me why!?



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-21-2008, 07:04 PM
tclaremont
 
Posts: n/a
Diggs:
Default Re: cfif

What is your objective? What is the failure mode?

You are asking if the page is not 1 OR if it is not 2. That means if it is 1
it meets the second condition of NOT being 2.


Wouldn't it be easier to ask if #page_indicator_a# GT 2? Or
<cfif #page_indicator_a# NEQ '1' AND #page_indicator_a# NEQ '2'>

Reply With Quote
  #3 (permalink)  
Old 11-21-2008, 08:44 PM
mega_L
 
Posts: n/a
Diggs:
Default Re: cfif

Wouldn't it be better if you use cfswitch instead of cfif?
<CFSWITCH expression="#page_indicator_a#">
<CFCASE value="1"> do something here</CFCASE>

<CFCASE value="2"> do something here </CFCASE>

</CFSWITCH>

Reply With Quote


  #4 (permalink)  
Old 11-21-2008, 08:54 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: cfif

idesdema wrote:

>
> Can someone tell me why!?
>


As tclaremnot said it is the 'OR'. The if statement will be true if
either side is true. So if the value is 1 then it is NOT 2 and so the
combination is true. If the value is 2 then it is NOT 1 and so the
combination is true. If the value is 3 then both NOT 1 and NOT 2 is
true so it is true.

You have written a statement that can never be false, unless you can
somehow have a value that is both 1 and 2 at the exact same time.

Now that I have my boolean logic lecture out of my system your solutions
is probably either:


<cfif #page_indicator_a# NEQ '1' AND #page_indicator_a# NEQ '2'>

OR

<cfif NOT (#page_indicator_a# EQ '1' OR #page_indicator_a# EQ '2')>
Reply With Quote
  #5 (permalink)  
Old 11-21-2008, 09:04 PM
tclaremont
 
Posts: n/a
Diggs:
Default Re: cfif

There are lots of ways to do this. I took the question as theoretical, and there is most definatley a problem with the theory in the original posters CFIF statement!
Reply With Quote
  #6 (permalink)  
Old 11-21-2008, 10:15 PM
idesdema
 
Posts: n/a
Diggs:
Default Re: cfif

It is clear now what I was doing wrong. OOPS. Thank you for the quick refresher course in boolean logic.

Sometimes when you've been coding all day my brain gets dull if not useless.
Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 07:31 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk