Solved

CFIF

Posted on 2012-03-16
4
454 Views
Last Modified: 2012-06-27
Experts,

Based on the code below, If my varibale (isMyVariable) is true then I need to use one CFIF, if not other CFIF. Here is what I am doing and throws me the

Context validation error for the cfelse tag.  
The tag must be nested inside a CFIF tag.  

What is the best way to hanlde thing?


<cfif isMyVariable EQ "True">
            <cfif ((variables.Variable1 NEQ Myquery1.Column1) AND (variables.Variable2 NEQ Myquery2.Column1))>
<cfelse>            
            <cfif ((variables.Variable1 NEQ Myquery3.Column1) AND (variables.Variable2 NEQ Myquery4.Column1))>
</cfif>
                  My Other Code for the big CFIF
            <cfelse>
                  Rest of the code            
            </cfif>


Thanks and appreciate your quick help.
0
Comment
Question by:Tpaul_10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Assisted Solution

by:erikTsomik
erikTsomik earned 125 total points
ID: 37730507
based on this your are missing the closing </cfif>


<cfif isMyVariable EQ "True">
            <cfif ((variables.Variable1 NEQ Myquery1.Column1) AND (variables.Variable2 NEQ Myquery2.Column1))>
           <cfelse>            
            <cfif ((variables.Variable1 NEQ Myquery3.Column1) AND (variables.Variable2 NEQ Myquery4.Column1))>
            </cfif>
</cfif>
                  My Other Code for the big CFIF
            <cfelse>
                  Rest of the code            
            </cfif>
0
 
LVL 4

Assisted Solution

by:JohnHowlett
JohnHowlett earned 250 total points
ID: 37730510
You've opened too many cfif's without closing them


<cfif isMyVariable EQ "True">
            <cfif ((variables.Variable1 NEQ Myquery1.Column1) AND (variables.Variable2 NEQ Myquery2.Column1))>
            </cfif>
<cfelse>            
            <cfif ((variables.Variable1 NEQ Myquery3.Column1) AND (variables.Variable2 NEQ Myquery4.Column1))>
             </cfif>
            My Other Code for the big CFIF
<cfelse>
            Rest of the code            
 </cfif>
0
 
LVL 4

Assisted Solution

by:JohnHowlett
JohnHowlett earned 250 total points
ID: 37730542
Or rather:

<cfif isMyVariable EQ "True">
            <cfif ((variables.Variable1 NEQ Myquery1.Column1) AND (variables.Variable2 NEQ Myquery2.Column1))>
            </cfif>
<cfelse>            
            <cfif ((variables.Variable1 NEQ Myquery3.Column1) AND (variables.Variable2 NEQ Myquery4.Column1))>
             </cfif>
            My Other Code for the big CFIF
 </cfif>

      Rest of the code
0
 
LVL 16

Accepted Solution

by:
Gurpreet Singh Randhawa earned 125 total points
ID: 37732064
rather this way:

<cfif isMyVariable EQ "True">
            <cfif ((variables.Variable1 NEQ Myquery1.Column1) AND (variables.Variable2 NEQ Myquery2.Column1))>
            </cfif>
<cfelseif isMyVariable EQ "False">            
            <cfif ((variables.Variable1 NEQ Myquery3.Column1) AND (variables.Variable2 NEQ Myquery4.Column1))>
             </cfif>
<cfelse>
            My Other Code for the big CFIF
 </cfif>
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question