I've been trying to get an OO query to return a two columns, with only
distinct values, but for some reason it was ignoring the
returnObjectField, and returning every column.

Heres my code.

<object name="ProductOption">
        <field source="Option" field="Name" />
        <hasOne name="Option">
                <relate from="OptionId" to="OptionId" />
        </hasOne>
</object>

<cfset pog = rf.createGateway("ProductOption")>
<cfset q = pog.createQuery()>
<cfset q.getWhere().isEqual("ProductOption", "ProductId", 1)>
<cfset q.getOrder().setAsc("ProductOption", "OptionId")>
<cfset q.returnObjectField("ProductOption", "OptionId")>
<cfset q.setDistinct(true)>

<cfdump var="#pog.getByQuery(q)#">

After much head scratching I removed the external field from the
ProductOption object and blew away my project files and it now works.  

Also, joining the tables "manually" does work and I get only my desired
columns
<cfset q.join("ProductOption", "Option", "Option")>
<cfset q.returnObjectField("Option", "Name")>

Is this a bug caused by the addition of the external fields feature?

Chris



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to