cancel
Showing results for 
Search instead for 
Did you mean: 

Searching name with single quote in filter for oModel read function

Former Member
0 Kudos

Hi Experts,

I am using oModel read function to read the service and am passing the filter for first name, last name and etc. It is working fine when there is no single quote in first name or last name, If there is any single quote present in the filter string then the filter functionality is not working correctly as expected. Please find below the code

this.oModel.read(sUrl, null, null, true, function(oEvent1) {

var out = formatter.formatEmpData(oEvent1.results);

}

);

sUrl is search parameter with filter function. when i debug i have the sUrl as "/EmpSet?$filter=Name eq 'o'john' "

In the backend we have field name as o'john with Aporstphe. The filter functionality is working fine without any single quotes for other values. Please share how to let us know if you handle this scenario in your use case.

Thanks,

Saravanan

Accepted Solutions (1)

Accepted Solutions (1)

former_member340030
Contributor
0 Kudos

Hi ,

Check out this link ... it will help you ..https://stackoverflow.com/questions/19319170/how-to-escape-single-quote-in-odata-filter-uri

thanks

Viplove

Former Member
0 Kudos

Hi Viplove,

Thanks for the reply. I solved the issue.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi All,

I have solved the above issue by changing the aporstphe with "%27%27". It worked for me.

Thanks,

Saravanan