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

Stange Cfquery NULL Error:

Participant ,
Apr 07, 2008 Apr 07, 2008
I was working on the project when i came to a sudden problem, Where i was running into an error.

The error was sometimes appearing and sometimes not so i just tries to use th IsNull UDF from cflib library but still error persists:

here is the error: i recieve:

The system has attempted to use an undefined value, which usually
indicates a programming error, either in your code or some system
code.

Null Pointers are another name for undefined values.


and this was my query that where i used iSnull and Still getting the error:

<cfquery name="qGetArticleInfo" datasource="#Request.ConsultantTrackSiteDSN#">
SELECT SiteSections_LOOKUP.SiteSectionName, SiteSections_LOOKUP.SiteSection_ID, Articles.ImageFileName, Articles.Content, Articles.CallOut, Articles.Teaser, Articles.Title, Articles.dtStartDate, Articles.SubTitle, Articles.Article_ID, Articles.lColumnLengths, Articles.iCalloutWidth, Articles.ImageHeight, Articles.ImageWidth, Articles.bPDFArticle, Articles.PDFFileName, Articles.SmallImageFileName, Articles.SmallImageWidth, Articles.SmallImageHeight, Articles.SmallImageOriginalFileName
FROM SiteSections_LOOKUP INNER JOIN Articles ON SiteSections_LOOKUP.SiteSection_ID = Articles.SiteSection_ID
WHERE Articles.bDeleted = 0
<cfif IsNull(IsDefined("Attributes.Article_ID"))>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsNull(IsDefined("Attributes.SiteSection_ID"))>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID# AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
ORDER BY Articles.dtStartDate DESC, Articles.Title
</cfquery>


i tried a lot but in vain can anybody help in this instance..
566
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 ,
Apr 07, 2008 Apr 07, 2008
check how you are using isnull() udf and how it actually should be used.

some pointers:
isdefined() returns either TRUE or FALSE
isnull() udf returns either TRUE or FALSE

see your mistakes?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
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
Participant ,
Apr 07, 2008 Apr 07, 2008
i changed a bit a code but still no sucees, here is my updated code:

<cfquery name="qGetArticleInfo" datasource="#Request.ConsultantTrackSiteDSN#">
SELECT SiteSections_LOOKUP.SiteSectionName, SiteSections_LOOKUP.SiteSection_ID, Articles.ImageFileName, Articles.Content, Articles.CallOut, Articles.Teaser, Articles.Title, Articles.dtStartDate, Articles.SubTitle, Articles.Article_ID, Articles.lColumnLengths, Articles.iCalloutWidth, Articles.ImageHeight, Articles.ImageWidth, Articles.bPDFArticle, Articles.PDFFileName, Articles.SmallImageFileName, Articles.SmallImageWidth, Articles.SmallImageHeight, Articles.SmallImageOriginalFileName
FROM SiteSections_LOOKUP INNER JOIN Articles ON SiteSections_LOOKUP.SiteSection_ID = Articles.SiteSection_ID
WHERE Articles.bDeleted = 0
<cfif IsNull("Attributes.Article_ID")>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsNull("Attributes.SiteSection_ID")>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID# AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>
ORDER BY Articles.dtStartDate DESC, Articles.Title
</cfquery>

but if remove th Isnull, and use only isdefined, then error still persists, no knowing what is going wrong here..
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 ,
Apr 07, 2008 Apr 07, 2008
the code inside <cfif IsNull("Attributes.Article_ID")> block will be
processed if it evaluates to TRUE, which is when attributes.article_id
is null - is that your intention?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
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
Mentor ,
Apr 07, 2008 Apr 07, 2008
Is this closer to what you are trying to do?

<cfif IsDefined("Attributes.Article_ID") AND NOT IsNull("Attributes.Article_ID")>
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsDefined("Attributes.SiteSection_ID") AND NOT IsNull("Attributes.SiteSection_ID")>
AND Articles.bActive <> 0 AND Articles.SiteSection_ID = #Attributes.SiteSection_ID#
AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>

Phil
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
Participant ,
Apr 07, 2008 Apr 07, 2008
basically we are just shifting from one server to another and using database mysql, so this error was coming up, no matter how. i am trying different approaches told by u guys and by own brain storms but still theat same kinda error:

Well i am stuck here?

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
Engaged ,
Apr 07, 2008 Apr 07, 2008
There is no such thing as a NULL in ColdFusion, if you are using some Java that can return NULLs then it will not create the variable at all, and if it already existed it will now not exist.

I do not see how the code you are showing us can have a null pointer exception, I suggest you step through the code line by line cfdumping what you have until you get the correct line number of the error.
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
Mentor ,
Apr 08, 2008 Apr 08, 2008
LATEST
Does something like this work?

<cfif IsDefined("Attributes.Article_ID") AND Attributes.Article_ID NEQ "">
AND Articles.Article_ID = #Attributes.Article_ID#
<cfelseif IsDefined("Attributes.SiteSection_ID") AND Attributes.SiteSection_ID NEQ "")>
AND Articles.bActive <> 0
AND Articles.SiteSection_ID = #Attributes.SiteSection_ID#
AND Articles.dtStartDate <= #CreateODBCDate(Now())#
</cfif>

Phil
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