|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Zealot
![]() ![]() Join Date: Mar 2003
Location: Maryland, USA
Posts: 109
|
CFSQL and calculated columns
The code:
Code:
<cfsearch collection="meetings" name="meetinglist"> <cfquery dbtype="query" name="test"> SELECT url, "#GetFileFromPath(key)# as filename FROM meetinglist </cfquery> Query manipulation error code = 0 Invalid SQL SQL= select url, "102203.pdf" as filename from meetinglist Datasource = "" The question: Is it possible to insert a column into a query using CFSQL? I have tried a number of times to do this without any success. What I am trying to do is take the search results and insert a column which has only the file names in it. TIA Michael Hatch |
|
|
|
|
|
#2 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Nashville, TN USA
Posts: 2,039
|
Not sure what you mean by CFSQL, but I think what you need to do is use single quotes around the file name instead of double quotes. SQL doesn't recognize double quotes as string delimiters.
|
|
|
|
|
|
#3 | |
|
SitePoint Zealot
![]() ![]() Join Date: Mar 2003
Location: Maryland, USA
Posts: 109
|
Quote:
I tried changing the double quotes to single quotes and now get a new error: unknown exception condition PCodeRuntimeContextImp::executeSQLTagCFQuery::endTag |
|
|
|
|
|
|
#4 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Nashville, TN USA
Posts: 2,039
|
Ah, I've used query of queries before, but I've never referred to it or heard it referred to as CFSQL... Learn something new every day, I guess.
At any rate, come to think of it, CFSQL does have some limitations. I know aggregate functions don't exactly work that well. So, this solution may work, but it may not be pretty. (This is assuming you want the same value for filename for every row in the query): Code:
<cfsearch collection="meetings" name="meetinglist"> <cfquery dbtype="query" name="test"> SELECT url FROM meetinglist </cfquery> <cfset FileNames = ArrayNew(1)> <cfloop query="test"> <cfset FileNames[CurrentRow] = GetFileFromPath(key)> </cfloop> <cfset a = QueryAddColumn(test, "filename", FileNames)> |
|
|
|
|
|
#5 | |
|
SitePoint Zealot
![]() ![]() Join Date: Mar 2003
Location: Maryland, USA
Posts: 109
|
Thanks Dave,
This actually works. I had to tweak a little for syntax but it works. I am still mildly annoyed that the original syntax doesn't work. I will have to try it at home on MX. Stuck with 5.0 here at work. Quote:
|
|
|
|
|
|
|
#6 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2002
Location: Nashville, TN USA
Posts: 2,039
|
Quote:
Glad I could be of (some) help... ![]() |
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 06:57.










Linear Mode
