Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Using a Filter Row with oData

Posted on by 44

I set up a query in our Development Environment to query the Sales Invoice Line table and get two columns. I would like to filter on, but not return, the Shipment Date column, so I set that as a Filter.

I then connected this to Web Services (oData) and tried to run a query using this filter:

(ShipmentDate ge datetime'2018-03-01T00:00:00Z' and ShipmentDate le datetime'2018-03-01T23:59:59Z')

Unfortunately it returns the following error:

Type 'NAV.WS_GetSalesInvoiceLinesTotals' does not have a property 'ShipmentDate'.

How can I use oData to filter on that column? Is there some other way to reference it? The query in Development Environment looks like this:

Type Data Source Name Method Type Method Group By
DataItem Sales Invoice Line GetSalesInvoiceLinesTotals
Column No. ItemNumber None (checked)
Column Quantity Quantity Totals Sum
Filter Shipment Date ShipmentDate

Thanks in advance!

*This post is locked for comments

  • Verified answer
    MikeWillis Profile Picture
    MikeWillis 44 on at
    RE: Using a Filter Row with oData

    It turns out that when you set a column as Filter, Nav adds "_FilterOnly" to the column name. So when you set up your filter, you have to refer to your column as "<ColumnName>_FilterOnly".

    In my case this became ShipmentDate_FilterOnly:

    (ShipmentDate_FilterOnly ge datetime'2017-06-01T00:00:00Z' and ShipmentDate_FilterOnly le datetime'2018-03-01T23:59:59Z')

    Interestingly, Nav returns this column in the result set, populated with bogus data ("0001-01-01T00:00:00" for the date field I'm filtering on).

  • MikeWillis Profile Picture
    MikeWillis 44 on at
    RE: Using a Filter Row with oData

    The problem is not adding the filter, that works fine. The problem is described in my question.

  • Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Using a Filter Row with oData

    To add a filter to an OData URI, add $filter= to the end of the name of the published web service.

    Something like $filter=ShipmentDate ge datetime'2018-03-01T00:00:00Z' and ShipmentDate le datetime'2018-03-01T23:59:59Z'

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans