|
Prev: The system has attempted to use an undefined value,which usually indicates a programming error, either in your codeor
Next: Application.cfm - Should I use queries or set sessionvariables?
From: Adam Cameron on 21 Jun 2008 11:47 > ORDER BY #colSort# ASC Are there any nulls in this column? Nulls and ORDER BY in QoQ don't play nice, sometimes. -- Adam
From: Adam Cameron on 23 Jun 2008 06:28 Can you just verify that the null pointer error is definitely referencing the line(s) of code where the QoQ is, and not a different part of the function? make sure you VAR all your variables in the function. Most aren't. It's not relevant to this, but you will make your code an awful lot clearer and easier to follow if you scope all your variables (eg: arguments.colSort, not simply colSort). What happens if you take the ORDER BY out? -- Adam
From: Adam Cameron on 23 Jun 2008 09:02 > No effect after removing order by clause ...... So, as per my question... what line of code is it pointing to? And did you do the other things I mentioned? -- Adam
From: Adam Cameron on 23 Jun 2008 12:27 > [i]javacast('String',colArray[qRowIndex]["ORDER_BY_PARAM"])[/i] > > That is wrong. An array cannot have a string as index. qRowIndex is an integer, set here: <cfloop from="1" to="#Arraylen(colArray)#" index="qRowIndex"> So that's perfectly fine. I think colArray is a poorly-named variable. It looks like an array of structs to me, and it's rather odd to have something called COLarray to be indexed by row (qRowIndex). So it's quite possibly something is afoot here. However rather than speculating... "lovely raj12"... what's the composition of colArray? It doesn't seem to be an array of columns (whatever that would be). -- Adam
From: Adam Cameron on 23 Jun 2008 14:37
> That's true. An array of structs is the only obvious possibility. I thought of > it, but ruled it out immediately. Well... let's let the OP rule that out ;-) > a key?). Also, an array of structs is conceptually a query with given row > numbers and column names. A lot of people assert this. An array of structs has its first "axis" indexed on positive integers, the second on string-based keys; a query has a similar structure. However the implementation of arrays / srtucts is quite different from how a query is implemented. Queries are a lot more complex. But, yeah, superficially they present the same. Bear in mind that each struct in an array of structs can have completely different keys from each other, andthey don't form "columns", whereas a query definitely has the concept of a column. > Then one would expect a query to be passed. Yes: in this instance, I wager the underlying data structure might lend itself better to be stored in a query rather than how it seems to be stored. > Thoughts like these made me not to think too deep about the javacast > expressions. A two-dimensional array made more sense. I have yet to see a sensible usage of a two-dimensional array in CF. I can think of uses (co-ordinated data, values in a matrix, etc), but usually when people have two-dimensional arrays, I really thing they're after a query, a struct of structs, or an array of structs. > Lovely Raj12 should dump it and have a > look before passing it to the blender. Yup. -- Adam |