Skip to Content

OData Query: How to skip every second entry?

I have a small webapp consuming an OData service (in particular the Message Management Service API of SAP Cloud Platform Internet of Things Service). I want to add a query option to my query to skip (e.g.) every second entry. Is that possible with OData options and how? Is there another solution? Filtering the data after downloading would be very unsatisfying. Maybe this may help: The queried data is sort by a timestamp but the duration between to data entries (difference in the timestamp) may vary. So a simple filter by divisibility of the timestamp is not possible.

Thanks in advance!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 27 at 12:33 PM

    Interesting, why do you want to get only the odd entries?

    If your entries had a sequence number starting at zero you could use $filter=seqno mod 2 eq 0 to get the "even" ones and $filter=seqno mod 2 eq 1 to get the "odd" ones.

    Add comment
    10|10000 characters needed characters exceeded