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

Q of Q question

LEGEND ,
Oct 12, 2007 Oct 12, 2007

Copy link to clipboard

Copied

I have a function that joins 7 csv files via cfhttp. I want to be able to
use that master query and search against it.

In another function I attempted to set the value of a variable to the result
of that fuction and then use QofQ to refine it but I am getting this error:

Message Complex object types cannot be converted to simple values.
Detail The expression has requested a variable or an intermediate expression
result as a simple value, however, the result cannot be converted to a
simple value. Simple values are strings, numbers, boolean values, and
date/time values. Queries, arrays, and COM objects are examples of complex
values.
The most likely cause of the error is that you are trying to use a complex
value as a simple one. For example, you might be trying to use a query
variable in a cfif tag.

I know the JoinRes works but don't know how to set it to a variable to use
again elsewhere in the web site.

Here are my functions:

<cffunction name="JoinedRes" access="public" returntype="query"
output="false" hint="I join all the Residentials">
<cfset files = getFileNames('ResFiles')>
<cfset i = 1>
<cfloop query="files">
<cfoutput>
<cfhttp
url=" http://www.bpoprosonline.com/assets/property/residential/#files.FileName#"
method="GET" name="Res#i#"
delimiter="|" textqualifier="" firstrowasheaders="yes" />
</cfoutput>
<cfset i = i + 1>
</cfloop>
<cfquery name="JoinedRes" dbtype="query">
SELECT * From Res1
<cfif isDefined('Res2')>
UNION
Select * From Res2
</cfif>
<cfif isDefined('Res3')>
UNION
Select * From Res3
</cfif>
<cfif isDefined('Res4')>
UNION
Select * From Res4
</cfif>
<cfif isDefined('Res5')>
UNION
Select * From Res5
</cfif>
<cfif isDefined('Res6')>
UNION
Select * From Res6
</cfif>
<cfif isDefined('Res7')>
UNION
Select * From Res7
</cfif>
ORDER BY City ASC
</cfquery>
<cfreturn JoinedRes>
</cffunction>

<cffunction name="ourListedProps" access="public" returntype="query"
output="false" hint="I return all BPO Pros Property from MLS">
<cfset residential = JoinedRes()>
<cfquery name="ourListedProps" dbtype="query">
Select DISTINCT(MLSNumber),PhotoURL,ListPrice,City,ListOfficeId FROM
#residential# WHERE ListOfficeId = 340169
</cfquery>
<cfreturn ourListedProps>
</cffunction>

--
Wally Kolcz
MyNextPet.org
Founder / Developer
586.871.4126


TOPICS
Advanced techniques

Views

233

Translate

Translate

Report

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
Guide ,
Oct 12, 2007 Oct 12, 2007

Copy link to clipboard

Copied

The source or table name in the QoQ needs to be a simple string. You're passing in a query object instead.

Votes

Translate

Translate

Report

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 ,
Oct 12, 2007 Oct 12, 2007

Copy link to clipboard

Copied

How can I change it to work as a qofq?


Votes

Translate

Translate

Report

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 ,
Oct 12, 2007 Oct 12, 2007

Copy link to clipboard

Copied

If I want to refine that query created by the cfhttp, how can I pass either
the table or source. I created a master query and want to use it as a query
to query against.


Votes

Translate

Translate

Report

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
Guide ,
Oct 12, 2007 Oct 12, 2007

Copy link to clipboard

Copied

LATEST
> <cfset residential = JoinedRes()>

The name of your query is "residential". Just use the name without the # signs.

You should also be using the keyword VAR on all of your local function variables. Right now all of your variables ("residential", etc). exist in the VARIABLES scope. If your component is stored in a shared scope, this can lead to unexpected results when multiple threads access the functions at the same.

Well its late here, I'm heading to sleep. Night.



Votes

Translate

Translate

Report

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
Documentation