Hi I want to retrieve a record via join but keep getting an error
message

Table 'menus' contains a foreign key FK_page to table 'pages'.  I have
a menuId and want to retrieve the corresponding row in table pages.

This is my transfer config (the relevant part)

                <package name="menu">
                        <!-- This table contains metadata for menuitems -->
                        <object name="menu" table="menus"
decorator="model.decorators.menuDecorator">
                                <id name="id" type="numeric"/>
                                <property name="name" type="string" 
column="name"
nullable="false" />
                                <property name="action" type="string" 
column="action"
nullable="true" />
                                <property name="active" type="boolean" 
column="active"
nullable="false" />
                                <property name="lft" type="numeric" 
column="lft" nullable="false" /
>
                                <property name="rght" type="numeric" 
column="rght"
nullable="false" />
                                <property name="FK_page" type="numeric" 
column="FK_page"
nullable="false" />
                                <!-- Link between a menu and it's page-->
                                <manytoone name="pages">
                                        <link to="CMS.page" column="FK_page" />
                                </manytoone>
                                <!-- Link between a menu and it's text-->
                                <onetomany name="menutexts">
                                        <link to="menu.menuTexts" 
column="FK_menuid"/>
                                        <collection type="array">
                                                <order property="id" 
order="asc"/>
                                        </collection>
                                </onetomany>
                        </object>

[...]
                <package name="CMS">
                        <object name="page" table="pages">
                                <id name="id" type="numeric"/>
                                <property name="title" type="string" 
column="title"
nullable="false" />
                                <property name="text" type="string" 
column="text"
nullable="false" />
                                <property name="contentInfo" type="string" 
column="contentInfo"
nullable="true" />
                                <property name="dateFrom" type="date" 
column="dateFrom"
nullable="true" />
                                <property name="showDateFrom" type="boolean"
column="showdateFrom" />
                                <property name="dateTo" type="date" 
column="dateTo"
nullable="true" />
                                <property name="showDateTo" type="boolean" 
column="showDateTo" />
                                <manytoone name="status">
                                        <link to="CMS.status" 
column="FK_status"/>
                                </manytoone>
                                <manytoone name="group">
                                        <link to="CMS.group" column="FK_group"/>
                                </manytoone>
                                <manytoone name="language">
                                        <link to="Language.language" 
column="FK_language"/>
                                </manytoone>
                        </object>
[..]

This is my CF code

<cfset query=rc.transfer.createQuery("select text from pages join
menus on pages.id=menus.FK_page where menus.id=:menuId")>
<cfset query.setParam("menuId","#rc.menuid#","numeric")>
<cfset rc.pageContent=rc.transfer.readByQuery("CMS.page",query)>

This is the result I get

Error Type:  Expression : [N/A]
Error Messages: The 2 parameter of the Left function, which is now -1,
must be a positive integer

A simpe cfquery

<cfquery name="pageContent" datasource="eenschoolintogo">
        select text from pages join menus on pages.id=menus.FK_page where
menus.id=#rc.menuId#
</cfquery>

Gives me exactly what I want.

How can I use transfer to do what I want here??

Thanks,

Marc

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to