+ Start a Discussion
SamuSamu 

How to add a spacial character in Query string

Hi All ,

 

I am  working on a simple filter condition where I am using the below Query String.

In the below string I am using 3 things mainly  "selectedfield" i am getting a value from picklist "values" is a text value where I am giving some value .I need to add the "%" .Now when I am giving the value with the "% " in text my query is working fine .I need to fix this value through Query .

 

CAn any one help me on this .

 

Below is the query  String:-

 

String queryIs='SELECT id,StageName,Opportunity_Owner_First_Name__c,Opportunity_Owner_Last_Name__c,Opportunity_Owner_formula__c,CreatedDate,Opportunity_Link__c FROM Opportunity where'+' '+selectedfield+' '+'Like:'+'values';

 

 

 

Thanks

Samu

Best Answer chosen by Admin (Salesforce Developers) 
MagulanDuraipandianMagulanDuraipandian

String sql = 'Select Name From Account WHERE Name LIKE \'%' + searchKeyword + '%\'';

 

 

https://sites.google.com/site/infallibletechie/like-operator-in-salesforce

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution.