View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > IsQuery PreviousNext

IsQuery

Determines whether value is a query.

True, if value is a query.

Decision functions, Query functions

IsQuery(value)

QueryAddRow

Parameter

Description

value

Query variable

<!--- Shows an example of IsQuery and IsSimpleValue --->
<h3>IsQuery Example</h3>
<!--- define a variable called "GetEmployees" --->
<CFPARAM name = "GetEmployees" DEFAULT = "#Now()#">

<p>Before the query is run, the value of GetEmployees is
<cfoutput>#GetEmployees#</cfoutput> <cfif IsSimpleValue(GetEmployees)> <p>GetEmployees is currently a simple value </cfif> <!--- make a query on the snippets datasource ---> <cfquery name = "GetEmployees" datasource = "cfsnippets"> SELECT * FROM employees </cfquery> <p>After the query is run, GetEmployees contains a number of rows
that look like this (display limited to three rows): <cfoutput QUERY = "GetEmployees" MaxRows = "3"> <pre>#Emp_ID# #FirstName# #LastName#</pre> </cfoutput> <cfif IsQuery(GetEmployees)> GetEmployees is no longer a simple value, but the name of a query </cfif>

Contents > CFML Reference > ColdFusion Functions > IsQuery PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


Grae Desmond said on Mar 24, 2004 at 10:30 AM :
You can also use IsQuery when you are using dynamic query names should the need arise. This may be obvious to some but is not explicitly stated above.

For Example, you have the following code.

<cfquery name="myquery" datasource="mydatasource">
Select * from mytable
</cfquery>

<cfset test = "myquery">

You can replace
IsQuery(#Evaluate("#test#")#) <!--- I found this in a developer's code --->
with
IsQuery("#query_name#")
Grae Desmond said on Mar 24, 2004 at 10:57 AM :
Last line should actually read
IsQuery("#test#")

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funct139.htm