Forum Discussion

The_Doc's avatar
The_Doc
Ultimate Cover User
2 months ago
Solved

OData queries are not working

Hi Folks Despite years of running MYOB's APIs I have never been successful at getting any ODATA queries to work. My APIs work - fine but if I need Sales Orders - I have to get them all and then s...
  • The_Doc's avatar
    2 months ago

    Hi Folks

    Don't you know it - as soon as I posted I went back to trying ODATA - and again nothing worked and then I spotted what seemed to be an insignificant error in the code

    "/Sale/Invoice/Item/?$Filter=startswith(Number,'RPWeb')"  doesn't work - this is from MYOB API developers web in which I have found many many errors.

    So I went to the link that takes me to the official ODATA 2.0 site and tried this line

    "/Sale/Invoice/Item/?$Filter=startswith(Number,'RPWeb') eq true"  doesn't work 

    but no joy

    "/Sale/Invoice/Item/?$filter=startswith(Number,'RPWeb') eq true"  WORKED!!!!!!

     

    I starred at this for hours and missed the obvious - 'Filter' - doesn't work - 'filter' does - ODATA is case sensitive.

    VB.NET - is not case sensitive

    VC#.NET is pedantically case sensitive to the extent that a variable named "Filter' is totally different to 'filter

     

    VBasic in Access is NOT

    ODATA it seems is - 

     

    I resisted posting for weeks - and as soon as I did - the solution popped out.

    Hope my dive into ODATA helps someone - they are fiddly though way, way more than SQL queries.

     

    The Doc