Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to send a null date to <cfqueryparam and avoid NullPointerException

Enthusiast ,
Nov 19, 2011 Nov 19, 2011

how can I avoid the error

faultCode:Server.Processing faultString:'Unable to invoke CFC - The cause of this output exception was that: java.lang.NullPointerException.' faultDetail:''

when I send a null date to

,<cfqueryparam cfsqltype="cf_sql_timestamp"   value="#ARGUMENTS.object.dateAcknowledged#" null="#isNull(ARGUMENTS.object.dateAcknowledged)#">

2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2011 Nov 19, 2011

Try replacing this:

null="#isNull(ARGUMENTS.object.dateAcknowledged)#

with something like this

null="#not isDate(ARGUMENTS.object.dateAcknowledged)#

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 19, 2011 Nov 19, 2011

thx, but

its not valid cfxml

The CFML compiler was processing:<ul><li>The tag attribute cf_sql_timestamp,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2011 Nov 19, 2011

Back up a bit.  The objective is to come up with a function that looks at arguments.object.dateacknowledged and returns either true or false, right?  That being the case, cfdump and cfabort are your freinds.  See what isDefined, isDate, StructkeyExists, etc return when you do and don't have a value in that structure.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 19, 2011 Nov 19, 2011

sorry, what i meant was the parser is not accepting

,<cfqueryparam cfsqltype="cf_sql_timestamp"   value="#ARGUMENTS.object.dateAcknowledged#" null="#not isDate(ARGUMENTS.object.dateAcknowledged)#>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 19, 2011 Nov 19, 2011
LATEST

stick the code elsewhere and works

    <cfset is_null = not isDate(ARGUMENTS.object.dateAcknowledged)>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources