File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,19 @@ public class SobjectQueryBuilder extends Soql {
309309 return childQuery ;
310310 }
311311
312+ public String getSubquery (Schema.SobjectField childToParentRelationshipField ) {
313+ String subquery = ' (SELECT ' + childToParentRelationshipField
314+ + ' FROM ' + this .sobjectType
315+ + super .doGetUsingScopeString ()
316+ + super .doGetWhereClauseString ()
317+ + super .doGetOrderByString ()
318+ + super .doGetLimitCountString ()
319+ + ' )' ;
320+
321+ System .debug (LoggingLevel .FINEST , subquery );
322+ return subquery ;
323+ }
324+
312325 public String getSearchQuery () {
313326 String sobjectTypeOptions = super .doGetQueryFieldString ()
314327 + super .doGetWhereClauseString ()
Original file line number Diff line number Diff line change @@ -401,6 +401,16 @@ public abstract class Soql implements Comparable {
401401 this .filterString = queryField + ' ' + Soql .getOperatorValue (operator ) + ' ' + formattedValue ;
402402 }
403403
404+ public QueryFilter (Schema.SobjectType childSobjectType , Boolean inOrNotIn , Schema.SobjectField lookupFieldOnChildSobject ) {
405+ this .operator = inOrNotIn ? Soql .Operator .IS_IN : Soql .Operator .IS_NOT_IN ;
406+ this .filterString = ' Id ' + Soql .getOperatorValue (this .operator ) + ' (SELECT ' + lookupFieldOnChildSobject + ' FROM ' + childSobjectType + ' )' ;
407+ }
408+
409+ public QueryFilter (SobjectQueryBuilder childSobjectQueryBuilder , Boolean inOrNotIn , Schema.SobjectField lookupFieldOnChildSobject ) {
410+ this .operator = inOrNotIn ? Soql .Operator .IS_IN : Soql .Operator .IS_NOT_IN ;
411+ this .filterString = ' Id ' + Soql .getOperatorValue (this .operator ) + ' ' + childSobjectQueryBuilder .getSubquery (lookupFieldOnChildSobject );
412+ }
413+
404414 public Integer compareTo (Object compareTo ) {
405415 QueryFilter compareToQueryFilter = (QueryFilter )compareTo ;
406416
You can’t perform that action at this time.
0 commit comments