?
Solved

CFIF

Posted on 2012-03-16
4
Medium Priority
?
460 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 500 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 1000 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 1000 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 500 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

765 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