You need to sign in to do that
Don't have an account?
NinoJose
HELP PLS! Creating a multiple Like Condition
Help please,
I have a situation where I need to create a dynamic like condition using Triggers.
Currently what I am doing is to use something like this
String whereClause = '';
for(Account t : Trigger.new){
whereClause += ' %' + (String)t.Id + '% Or Name like ';
}
whereClause = whereClause.substring(0,(whereClause.length()-15));
List<Account> accts = new List<Account> new ([Select Id, Name From Account Where Name like :whereClause]);
however Im getting error on bulk processing maybe because dynamic creation of SOQL Statement is not allowed in Apex.
My question is, is there any other way I could do a like condition for multiple values????
I hope someone could save me from this problem.
I have a situation where I need to create a dynamic like condition using Triggers.
Currently what I am doing is to use something like this
String whereClause = '';
for(Account t : Trigger.new){
whereClause += ' %' + (String)t.Id + '% Or Name like ';
}
whereClause = whereClause.substring(0,(whereClause.length()-15));
List<Account> accts = new List<Account> new ([Select Id, Name From Account Where Name like :whereClause]);
however Im getting error on bulk processing maybe because dynamic creation of SOQL Statement is not allowed in Apex.
My question is, is there any other way I could do a like condition for multiple values????
I hope someone could save me from this problem.
NinoJose
This post is already old but I just wanted to reply to my inquiry so that any new developer who stumble on this issue will be able to work with it.
Currently v14.0 Winter 09 now supports dynamic SOQL so creating the dynamic like condition is now possible unlike before.