Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Adam Bourg
I solved it with the first couple of posts help. New code: cffunction name=isStudentEmployee returntype=boolean hint=Method to determine if the person logged in is a student or pro staffer, will corelate to a control structure if student employee throw up access denied

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Kelly
Awesome! :) On 1/26/2011 1:31 PM, Adam Bourg wrote: I solved it with the first couple of posts help. New code: cffunction name=isStudentEmployee returntype=boolean hint=Method to determine if the person logged in is a student or pro staffer, will corelate to a control structure if

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer
On Wed, Jan 26, 2011 at 11:31 AM, Adam Bourg adam.bo...@gmail.com wrote: I solved it with the first couple of posts help.      cfif isStudentEmployee.recordcount eq 0          cfreturn true      cfelse          cfreturn false      /cfif Glad you got it working. You can tighten that

RE: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Che Vilnonis
Charlie, is this true only when the return type is Boolean? Otherwise, it should return the actual recordcount, right? Thanks, Che You could also drop the comparison itself since CF does implicit boolean conversion. cfreturn isStudentEmployee.recordcount / ^That'll do the same thing.

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Scott Stroz
Actually, these will not return the same value. Lets assume the query returns 0 records. cfreturn isStudentEmployee.recordcount = 0 / will return true cfreturn isStudentEmployee.recordcount / will return false On Wed, Jan 26, 2011 at 1:43 PM, Charlie Griefer charlie.grie...@gmail.com wrote:

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer
Well, it will return the actual recordcount... which is a number. But CF implicitly converts numeric values to boolean values. Any non-zero value is true, while any zero value is false. So given the following code: cfif myCFC.myMethod()do something/cfif ... assuming myMethod returns a numeric

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Scott Stroz
Let me correct that. cfreturn isStudentEmployee.recordcount = 0 / will return true but cfreturn isStudentEmployee.recordcount / will evaluate to false On Wed, Jan 26, 2011 at 2:06 PM, Scott Stroz boyz...@gmail.com wrote: Actually, these will not return the same value. Lets assume the query

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer
d'oH! Good catch. So if you go the implicit boolean conversion route, switch the return true for return false... On Wed, Jan 26, 2011 at 12:06 PM, Scott Stroz boyz...@gmail.com wrote: Actually, these will not return the same value. Lets assume the query returns 0 records. cfreturn

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Matt Quackenbush
One last note. You need to var scope your query. cfset var isStudentEmployee = / cfquery name=isStudentEmployee ~| Order the Adobe Coldfusion Anthology now!

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Ezra Parker
On Wed, Jan 26, 2011 at 10:43 AM, Charlie Griefer charlie.grie...@gmail.com wrote: cfreturn isStudentEmployee.recordcount = 0 / Unless I'm missing something, this should be: cfreturn isStudentEmployee.recordcount eq 0 / -- Ezra Parker

Re: Return boolean from a CFC query -- UPDATE: Solved

2011-01-26 Thread Charlie Griefer
On Wed, Jan 26, 2011 at 12:30 PM, Ezra Parker e...@cfgrok.com wrote: On Wed, Jan 26, 2011 at 10:43 AM, Charlie Griefer charlie.grie...@gmail.com wrote: cfreturn isStudentEmployee.recordcount = 0 / Unless I'm missing something, this should be: cfreturn isStudentEmployee.recordcount eq 0 /