[Coldbox 4.3.0][Coldfusion 11]Query Of Queries runtime error. Table named programmes was not found

13 views
Skip to first unread message

echo

unread,
Nov 19, 2017, 11:04:40 PM11/19/17
to ColdBox Platform
Hi, I am writing a function in model service, doing query of queries. The code is as followed:

      public function getProgramBu(programmes){
writedump(programmes);
var temp=programmes_busService.executeQuery("from programmes_bus");
var q= new query();
q.setName("myQuery");
q.setDBType("query");
q.setAttributes(sourceQuery=programmes);
var result= q.execute(sql = "select * from programmes, temp where temp.programme_id = programmes.id").getresult();
writedump(result);
abort;
}
 when I dump the programmes which is passed in as a parameter, the correct query shows. Temp as well. However, when it goes to execute sql. The error is
 Query Of Queries runtime error. 
Table named programmes was not found in memory. The name is misspelled or the table is not defined.
I wonder what is wrong. Thanks a lot for your help.

Icy

Ancient Programmer

unread,
Nov 19, 2017, 11:49:39 PM11/19/17
to ColdBox Platform

Change the query to this:
var result= q.execute(sql = "select * from sourceQuery, temp where temp.programme_id = sourceQuery.id").getresult();

echo

unread,
Nov 20, 2017, 1:12:12 AM11/20/17
to ColdBox Platform
Thankssssss. It works^^ (I had some misunderstanding on setAttributes before)
Thanks again~
Reply all
Reply to author
Forward
0 new messages