ORM relationship using EntityLoad issues
Hi, quick question, if anyone can help. below you can see a entity for Campaign model. I want to get all campaign that have a company id of x (1 to many relationship) so i tried this returnobj = EntityLoad(Campaign,{company='1'},#sortColumn# #sort#); however this gives me the following error... You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. how can i get all the campaign that have a company of x from my realtionship?? Model component output=false persistent=true { property name=camp_id type=numeric ormtype=int fieldtype=id generator=identity sqltype=int; property name=camp_description column=camp_description type=string ormtype=string; /* relationships*/ property name=company fieldtype=many-to-one fkcolumn=com_id cfc=company; ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338323 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: ORM relationship using EntityLoad issues
Syntax Looks valid to me, perhaps it is just tempremental about the quotes. try returnobj = EntityLoad(Campaign,{company=1},#sortColumn# #sort#); are you sure sortorder and sort are simple variables and not complex variables ? Russ On Tue, Oct 19, 2010 at 6:50 PM, Glyn Jackson glyn.jack...@newebia.co.ukwrote: Hi, quick question, if anyone can help. below you can see a entity for Campaign model. I want to get all campaign that have a company id of x (1 to many relationship) so i tried this returnobj = EntityLoad(Campaign,{company='1'},#sortColumn# #sort#); however this gives me the following error... You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. how can i get all the campaign that have a company of x from my realtionship?? Model component output=false persistent=true { property name=camp_id type=numeric ormtype=int fieldtype=id generator=identity sqltype=int; property name=camp_description column=camp_description type=string ormtype=string; /* relationships*/ property name=company fieldtype=many-to-one fkcolumn=com_id cfc=company; ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338324 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: ORM relationship using EntityLoad issues
This error occurs when you use a function on a string that is looking for a structure. Dump your variables and see which one has a string value instead of a key value pairs. On Tue, Oct 19, 2010 at 10:50 AM, Glyn Jackson glyn.jack...@newebia.co.uk wrote: Hi, quick question, if anyone can help. below you can see a entity for Campaign model. I want to get all campaign that have a company id of x (1 to many relationship) so i tried this returnobj = EntityLoad(Campaign,{company='1'},#sortColumn# #sort#); however this gives me the following error... You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338337 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: ORM relationship using EntityLoad issues
Hi Russ, sort ect are def just simple vars. I have hard coding the sortcolum and sort vars and got the same error. it looks right to me also, company is not a string tho should it be something like this EntityLoad(Campaign,{company.getCom_id(1)},#sortColumn# #sort#); however i know that won't work. if i dump out Campaign this is what I see... camp_id 1 camp_name 1 camp_description 1 camp_startDate{ts '2010-10-10 00:00:00'} camp_endDate {ts '2010-10-17 00:00:00'} camp_active YES company [cfc2] component model.company PROPERTIES com_id 1 com_name Glyn Inc Syntax Looks valid to me, perhaps it is just tempremental about the quotes. try returnobj = EntityLoad(Campaign,{company=1},#sortColumn# #sort#); are you sure sortorder and sort are simple variables and not complex variables ? Russ On Tue, Oct 19, 2010 at 6:50 PM, Glyn Jackson glyn.jack...@newebia.co.ukwrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338343 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: ORM relationship using EntityLoad issues
Company is a structure for sure (struct posted above in reply to Russ) I asumed something like this would work, but no joy i.e. company.getcom_id(1) This error occurs when you use a function on a string that is looking for a structure. Dump your variables and see which one has a string value instead of a key value pairs. On Tue, Oct 19, 2010 at 10:50 AM, Glyn Jackson glyn.jack...@newebia.co.uk wrote: Hi, quick question, if anyone can help. below you can see a entity for Campaign model. I want to get all campaign that have a company id of x (1 to many relationship) so i tried this returnobj = EntityLoad(Campaign,{company='1'},#sortColumn# #sort#); however this gives me the following error... You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338345 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: ORM relationship using EntityLoad issues
Not clear what variable you are trying to set in campaign but if company is a structure, you possibly could do this: EntityLoad('Campaign',{company_id = company.getCom_id(1)},#sortColumn# #sort#); On Tue, Oct 19, 2010 at 1:58 PM, Glyn Jackson glyn.jack...@newebia.co.uk wrote: Hi Russ, sort ect are def just simple vars. I have hard coding the sortcolum and sort vars and got the same error. it looks right to me also, company is not a string tho should it be something like this EntityLoad(Campaign,{company.getCom_id(1)},#sortColumn# #sort#); however i know that won't work. if i dump out Campaign this is what I see... camp_id 1 camp_name 1 camp_description 1 camp_startDate {ts '2010-10-10 00:00:00'} camp_endDate {ts '2010-10-17 00:00:00'} camp_active YES company [cfc2] component model.company PROPERTIES com_id 1 com_name Glyn Inc Syntax Looks valid to me, perhaps it is just tempremental about the quotes. try returnobj = EntityLoad(Campaign,{company=1},#sortColumn# #sort#); are you sure sortorder and sort are simple variables and not complex variables ? Russ On Tue, Oct 19, 2010 at 6:50 PM, Glyn Jackson glyn.jack...@newebia.co.ukwrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338346 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm