Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Business Central forum

Web Services(ODataV4) filter on BC

(0) ShareShare
ReportReport
Posted on by 3,957
Hi All,
I've created custom Sales Header Page and Sales Line Page to extract data using Web Services in ODataV4.
I want to apply filters I tried applying filters as follows
1. api.businesscentral.dynamics.com/.../Company('CRONUS%20USA%2C%20Inc.')/DWSalesOrderLinesAPI?$count=true&$filter=Shipment_Date%20gt%202018-01-01T23:59:59.999Z
giving error: 'Unable to convert value to Date'
2. api.businesscentral.dynamics.com/.../Company('CRONUS%20USA%2C%20Inc.')/DWSalesOrderLinesAPI?$count=true&$filter=Shipment_Date%20eq%20'2018-09-19'
giving error: A binary operator with incompatible types was detected. Found operand types 'Edm.Date' and 'Edm.String' for operator kind 'Equal'
I've refered here:
I'm wondering if these filters are available for Web Services or API in BC?
And also what exactly is the difference between API and WebService(ODataV4) as I've found few differences like Parent-Child relationship and complex data types.
Kindy advise!
Categories:
  • Verified answer
    Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: Web Services(ODataV4) filter on BC

    Hi Stefano,

    I could get the filtered results with query as below

    https://api.businesscentral.dynamics.com/v1.0/:tenant/ODataV4/Company('CRONUS%20USA%2C%20Inc.')/DWSalesOrderLinesAPI?$count=true&$filter=Shipment_Date%20ge%202018-05-01 

    Also, I found that the filter is specific to the data type of the field

    For example:

    Date = 2018-09-09

    DateTime = 2018-09-19T20:05:52.667Z

    Integer = 1

    Decimal = 1.00

    Text = ‘Text’

    Code = ‘PS’

    Options = ‘Order’/’Quote’

    Boolean = true/false

    I'll try the query as you provided and give the feedback thanks.


  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Web Services(ODataV4) filter on BC

    The datetime filter is wrong.

    You should write something like:

    Shipment_Date ge datetime'2018-01-01T00:00:00Z'

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,317 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans