You need to sign in to do that
Don't have an account?
Using variable in APEX SOQL
Hi,
I am creating a SOQL query where the field name and the field value in where clause, both comes dynamically. Eg:
something like:
String fieldname = 'Name';
Account account = [Select Id from Acocunt where :fieldname like 'ABC'];
This doesnt works :(
Can anyone please advise, how can i get this query?
Thanks
[GM]
You can place variables in the value, not in the field name portion of the where clause.
Hi,
I am facing a similar problem and needs a work around. Actually i need to implement search option using APEX, so is it possible to use SOSL within APEX like we do it with API.
Suggestion welcomed...
Thanks
Siddharth
For adding a variable in SOQL, what is the syntax?
e.g.
That clearly is bad.
If there's a way, is it applicable for both Apex code and Ajax toolkit?
Thanks for any comment,
Aki