Because IIF rocks

-----Original Message-----
From: Stephen Moretti [mailto:[EMAIL PROTECTED]] 
Sent: 05 February 2003 16:15
To: [EMAIL PROTECTED]
Subject: Re: [ cf-dev ] Apostrophes in Iif()


Aiden,

> Does anyone know the correct syntax which allows you to do something 
> like this (below) in a cfquery block, so that if anything was supplied

> in a form field, it returns the string "null", otherwise, it's 
> evaluated and wrapped in single quotes: #Iif(not 
> Len(Trim(Form.Field)), "null", "'" & DE(Trim(Form.Field)) &"'")#
>
Your DE aren't in the right price.

#IIF(not Len(trim(Form.fieldname)),
DE("Null"),DE("'"&Trim(form.fieldname)&"'"))#

but why not use

<cfif Len(Trim(form.fieldname)) EQ 0>IS
NULL<cfelse>'#Trim(form.fieldname)#'</cfif>

Stephen



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] For
human help, e-mail: [EMAIL PROTECTED]


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to