Solved

CFIF

Posted on 2012-03-16
4
446 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
  • 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 15

Accepted Solution

by:
myselfrandhawa 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now