Skip to main content
Known Participant
March 21, 2007
Question

<cfif Len(Trim(Form.Comments)) GT 0>'#Trim(Form.Comments)#'<cfelse>NULL</cfif>

  • March 21, 2007
  • 1 reply
  • 1933 views
just lookind at a existing code

why is this null used in this field.
what is the purpose of this code?

<cfif Len(Trim(Form.Comments)) GT 0>'#Trim(Form.Comments)#'<cfelse>NULL</cfif>

thanks
This topic has been closed for replies.

1 reply

Inspiring
March 22, 2007
Without the context of the code is impossible to know what exactly that code does, but for example, if you are inserting or updating a field in a DB, the situation could be (inside a CFQUERY):

UPDATE table SET field=<cfif Len(Trim(Form.Comments)) GT 0>'#Trim(Form.Comments)#'<cfelse>NULL</cfif>

The code means : If Form.Comments is not empty (len > 0) then return Form.comments trimmed, else return NULL.

Regards