Skip to Content
0

Searching name with single quote in filter for oModel read function

Jul 06, 2017 at 04:39 PM

55

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
VIPLOVE KHUSHALANI Jul 07, 2017 at 01:36 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Viplove,

Thanks for the reply. I solved the issue.

0
avatar image
Former Member Jul 07, 2017 at 08:26 PM
0

Hi All,

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

Thanks,

Saravanan

Share
10 |10000 characters needed characters left characters exceeded