Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: rubo18
I got this working with SQL, but would still be interested in a possible CF workaround if it's out there, thanks :)
Copy link to clipboard
Copied
quote:
Originally posted by: -==cfSearching==-
quote:
Originally posted by: rubo18
I got this working with SQL, but would still be interested in a possible CF workaround if it's out there, thanks :)
As you can see you have a few choices 🙂 ArraySum is an equally valid option. Though you may need a few more functions to convert the query column to an array.
<cfset columnTotal = ArraySum(ListToArray(ValueList(yourQuery.ColumnName)))>
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: -==cfSearching==-
Dan Bracuk,
I am curious. Why do you say that? I could not get arraysum(NameOfQuery["NameOfColumn"]); to work without the extra functions. That would be cool it if worked without them.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: -==cfSearching==-
An error. The error message suggests CF cannot implicitly convert a coldfusion.sql.QueryColumn object to an array. Does it work for you?
[Table (rows 3 columns ColumnName): [ColumnName: coldfusion.sql.QueryColumn@14f8035] ] is not indexable by NameOfColumn
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: rubo18
Thankyou everyone, I shall try some of these out! Although I found the SQL way was much easier than I anticipated it to be, so may just stick with that.
Umm, do I mark you all as giving the answer?? Sorry, don't know the proper etiquette here!