function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MarkL.ax269MarkL.ax269 

bug using list controller and parent/child query with colon

I'm using a list controller and a parent-to-child query to return a fairly simple list of parent records and their associated children. Note that the children have a lookup relationship to the parent. I want to filter the children in the child query using "in" criteria, but I keep getting this error:

 

Variables__r where Variable_Master__c in :this.vmIds) from Account ^ ERROR at Row:1:Column:106 unexpected token: ':'

 

It looks like this type of filter doesn't work in child relationship queries in a list controller.  I know vmIds is a valid list because I use it elsewhere without a problem.

 

This errors:

 

setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, Name, (select Id, Account__c, Variable_Master__c from Variables__r where Variable_Master__c in :this.vmIds) from Account where Name like :this.queryAcct and Status__c = 'Active' order by Name]));

 This works:

 

 

setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, Name, (select Id, Account__c, Variable_Master__c from Variables__r) from Account where Name like :this.queryAcct and Status__c = 'Active' order by Name]));

 This also works:

 

setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, Name, (select Id, Account__c, Variable_Master__c from Variables__r where Variable_Master__r.Name like 'S%') from Account where Name like :this.queryAcct and Status__c = 'Active' order by Name]));

 

 

Anyone ever seen something like this?  I first built a version that returned a simple list (didn't use a StandardSetController) and while that worked, I occasionally got record sets that were too large.  So I changed it to the list controller and started seeing this problem.  It's only when I use the colon notation that it errors, looks like a bug.