Skip to main content
December 14, 2011
Answered

CFML structure referenced as part of an expression error

  • December 14, 2011
  • 2 replies
  • 2663 views

I'm getting an error where the message says "Element ON HOLD-GENERAL is undefined in a CFML structure referenced as part of an expression".  I have had this error in the past where helpful poster pointed the problem.  I looked for the same issue here but do not see the probelm.  Please view source code here:  http://pastebin.com/2A059LEE.  Output is located here: http://pastebin.com/31a2qEYS.   "On-Hold General" is what I have in my database.

    This topic has been closed for replies.
    Correct answer Adam Cameron.

    This error is always going to be caused by the same thing: structJobStatus["ON HOLD-GENERAL"] doesn't exist.  There's no point in asking "what causes this" more than once, because the answer will always be the same, and the solution to working out why is always going to be the same.

    Dump structJobStatus before the error, and look at what's in it.  You will observe it does not have in it what you think it does.  Work backwards through your logic to determine why that is.

    --

    Adam

    2 replies

    Adam Cameron.Correct answer
    Inspiring
    December 14, 2011

    This error is always going to be caused by the same thing: structJobStatus["ON HOLD-GENERAL"] doesn't exist.  There's no point in asking "what causes this" more than once, because the answer will always be the same, and the solution to working out why is always going to be the same.

    Dump structJobStatus before the error, and look at what's in it.  You will observe it does not have in it what you think it does.  Work backwards through your logic to determine why that is.

    --

    Adam

    December 14, 2011

    I see the problem. Thank you. I'm also trying to display the date in the last updated column but its outputting "40761.6458333" for some reason.

    Owainnorth
    Inspiring
    December 14, 2011

    Deja-vu?

    Turn on proper debug logging and it'll tell you exactly what line it's on. Just before trying to reference the variable, do a cfdump of the struct then a cfabort to see if what's in it is what you think it is.

    Which it clearly isn't.