Skip to Content
avatar image
Former Member

Searching name with single quote in filter for oModel read function

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 07, 2017 at 01:36 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

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

    Hi All,

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

    Thanks,

    Saravanan

    Add comment
    10|10000 characters needed characters exceeded