Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

ODATA URI not contains doesn't work

Posted on by 7

Hi,

I want every record that doesn't contain a specific word.

I've tried the following:

"not(contains({Field}, '{Value}'))" resulting in "Client requests that contain ''Not'' filter options are not supported by Dynamics 365 Business Central OData web services."

"not contains({Field}, '{Value}')" resulting in "Client requests that contain ''Not'' filter options are not supported by Dynamics 365 Business Central OData web services."

"indexof({Field}, '{Value}') eq -1" resulting in "Client requests that contain ''indexof'' filter options are not supported by Dynamics 365 Business Central OData web services."

Can anyone explain why this is happening and why these things are not supported while the documentation here says that it does and how I can fix this?\

learn.microsoft.com/.../use-filter-expressions-in-odata-uris

  • B Menick Profile Picture
    B Menick 7 on at
    RE: ODATA URI not contains doesn't work

    Hi

    I found a solution to this.

    I found out that contains works in a bit of a weird way. We need to compare it to a boolean.

    For example:

    contains({Field}, '{Value}') eq true

    But to check if it DOESN'T contain a certain value we have to use ne true instead of eq false. Because eq false doesn't return any records but says that the odata uri query is valid. So for some reason using ne true does return the correct records.

    For example:

    WORKS: contains({Field}, '{Value}') ne true

    DON'T WORK: contains({Field}, '{Value}') eq false

  • B Menick Profile Picture
    B Menick 7 on at
    RE: ODATA URI not contains doesn't work

    Hi Daniele

    The problem with the first link is that my list would be way too big. There are too many combinations to consider which is why I need a contains functionality or something similar to that.

    The second link is a link that I'm already aware of. But for some reason some of those filter expressions are not supported. Any idea why?

    Bo

  • B Menick Profile Picture
    B Menick 7 on at
    RE: ODATA URI not contains doesn't work

    Hi Zhu

    I've tried a few things as described above. Which one of the things was the indexof and unfortunately it says that it isn't supported.

    Bo

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,411 Super User 2024 Season 2 on at
    RE: ODATA URI not contains doesn't work

    Hi, unfortunately, as far as I know, "not" is not supported in BC's API and Odata's filter method.

    I'm not sure if "indexof" is supported. Anyway we can only avoid using these methods.

    Hope that other experts can give you better advice.

    Thanks.

    ZHU

  • DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,104 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans