Just curious and wanted feedback/drawbacks from the group on this approach:
<cfif User.getUserId()>
rather than this:
<cfif len(User.getUserId()) and User.getUserId()>



Thanks,
Doug S.
www.evenamonkey.com



On 8/10/06, SAL VALVERDE <[EMAIL PROTECTED]> wrote:

 hey thanks Jared...
 and for the quick response too...


 sal



 Jared Rypka-Hauer wrote:
 <cfif len(obj.getUserId())> is usually how people do it,
but that can be frustrating if it returns 0, which means it
hasn't been loaded too.

<cfif len(User.getUserId()) and User.getUserId()> will
cover you if your userId is 0 (which means nothing's been
loaded because 0 isn't a valid pkey value in most cases).

Laterz,
J

On Thu, 10 Aug 2006 11:24:15 -0600
 SAL VALVERDE <[EMAIL PROTECTED]> wrote:


 Hello all,
I have a quick simple question that I hope someone can
enlighten me with...
What would be best practice to see if a record object has
been loaded or not? my current script is as follows:

<cfif len(userRecord)>
 <cfset
arguments.event.setValue("badLogin","Invalid Username
or Password") />
 <cfset
arguments.event.addResult("notLoggedIn") />
 <cfelse>
 <cfset session.isLoggedIn = true />
 <cfset session.username =
#userRecord.getuserName()# />
 <cfset arguments.event.addResult("loggedIn")
/>
 </cfif>

"userRecord" being the object...


I'm getting the following error:

Complex object types cannot be converted to simple
values.
*Detail* The expression has requested a variable or an
intermediate expression result as a simple value,
however, the result cannot be converted to a simple
value. Simple values are strings, numbers, boolean
values, and date/time values. Queries, arrays, and COM
objects are examples of complex values.

The most likely cause of the error is that you are trying
to use a complex value as a simple one. For example, you
might be trying to use a query variable in a <CFIF> tag.
This was possible in ColdFusion 2.0 but creates an error
in later versions.


thanks in advance...
sal


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at:
http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at:
http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --






-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --

Reactor for ColdFusion Mailing List
[email protected]
Archives at:
http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to