AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • Rolodex
    • Podcast
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Acumatica OData wit...
Applying Filters in...
 
Notifications
Clear all

#AcumaticaTnT Applying Filters in OData

 
Acumatica OData with Microsoft Excel and Power BI
Last Post by Tim Rodman 4 years ago
10 Posts
5 Users
3 Reactions
12.4 K Views
RSS
animal
Posts: 10
 animal
Topic starter
November 24, 2017 11:43 pm
(@animal)
Eminent Member
Joined: 8 years ago

I've heard that it's possible to apply filters using OData.

I'd like to do this because I have a lot of data in Acumatica and I want to do the filtering on the Server rather than bringing everything back into Excel or Power BI and then doing my filtering there.

Does anyone know how to do this?


Eliso Gotoshia reacted
9 Replies
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
November 25, 2017 12:24 am
(@timrodman)
Famed Member
Joined: 10 years ago

Hey Animal,

You can definitely do this and it's a great idea too for the reason that you mentioned: Server-side filtering is faster, especially when the amount of data in Acumatica is very large.

Let's say that I have the following Generic Inquiry in Acumatica...

... and I want to access that data in Excel.

 

I can use the following URL to access the Generic Inquiry (notice that ALL of the data appears):

 http://127.0.0.1/Acumatica7/odata/Testing 

Also, note in the screenshot above that any spaces in field names get removed by OData so I had to reference VendorID rather than Vendor ID.

 

If I want to only see Mr. Peter Lai (EP00000022), then I can add some stuff onto the end of my URL like this (note how now only one record is returned):

 http://127.0.0.1/Acumatica7/odata/Testing?$filter=VendorID  eq 'EP00000022'

 

Maybe I don't want to see Vendors with a Status of Inactive. If that's the case, then I can do this:

http://127.0.0.1/Acumatica7/odata/Testing?$filter=Status ne 'Active'

 

Or maybe I have the following Generic Inquiry in Acumatica...

 

... which looks like this in Excel:

 

Now, suppose I want to only show documents that are larger than $2,000. I can do this:

 http://127.0.0.1/Acumatica7/odata/BillsAndAdjustments?$filter=DetailTotal  gt 2000

Note: for Greater Than use gt, for Greater Than or Equal use ge, for Less Than use lt, for Less Than or Equal use le.

 

You can also combine filters. Maybe I want to see all documents than are between $2,000 and $3,000. I can do this:

 http://127.0.0.1/Acumatica7/odata/BillsAndAdjustments?$filter=DetailTotal  ge 2000 and DetailTotal le 3000

 

There are more filters available in OData (click here), but as far as I can tell, Acumatica hasn't implemented them yet.


Reply
Rob Neal reacted
animal
Posts: 10
 animal
Topic starter
November 25, 2017 12:30 am
(@animal)
Eminent Member
Joined: 8 years ago

Thanks Tim. This is definitely a start, but it would be great if Acumatica were to implement those other OData filters that you linked to at the bottom, especially useful for filtering on Dates and finding parts of names with a contains search.


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
February 21, 2018 6:24 pm
(@timrodman)
Famed Member
Joined: 10 years ago

Thanks to Anahi over on this thread for pointing out a way to filter on dates.

 

Based on the suggestion, the following works for me for records with dates that are greater than or equal to January 1st, 2015:

 http://127.0.0.1/Acumatica7/odata/BillsAndAdjustments?$filter=Date  ge datetime'2015-01-01'

 

And this works for me to only get records in January 2015:

 http://127.0.0.1/Acumatica7/odata/BillsAndAdjustments?$filter=Date  ge datetime'2015-01-01' and Date le datetime'2015-01-31'

Reply
Anahi Zent reacted
CodeNeedsCoffee
 CodeNeedsCoffee
(@codeneedscoffee)
Joined: 5 years ago

Active Member
Posts: 5
May 21, 2019 2:14 pm
Reply toTim RodmanTim Rodman

In your odata feed url, you used eq, ge, and le. Is there a way to also do something like "contains"?

Example:

  http://127.0.0.1/Acumatica7/odata/BillsAndAdjustments?$filter=Date  contains '2015-01-01'

Thanks!


Reply
Royce Lithgo
 Royce Lithgo
(@roycelithgo)
Joined: 5 years ago

Honorable Member
Posts: 557
May 21, 2019 7:50 pm
Reply toCodeNeedsCoffeeCodeNeedsCoffee
Tim Rodman

How can a date 'contain' a date? How is this any different from eq?


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
May 31, 2019 5:58 pm
(@timrodman)
Famed Member
Joined: 10 years ago

I agree that it wouldn't make sense for dates, but for a text contains function search this post for "substringof"

https://www.odata.org/documentation/odata-version-2-0/uri-conventions/

I'm not sure though if Acumatica has implemented the substringof function.


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
June 11, 2021 4:23 pm
(@timrodman)
Famed Member
Joined: 10 years ago

Hey @gabriel,

I really like the OData filtering article that you have on your website:
https://support.velixo.com/hc/en-us/articles/360043950572-Advanced-Filtering-in-GI-Functions

 

You have a Contains function available which I'm trying to use in OData, but I'm not able to get it to work. Are you using the contains function that is mentioned in this OData article that you linked to?
https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#_Toc31360982

 

I get results with this OData URL:

 http://localhost/acumatica2021r1/odata/production/Invoice  Lines
image

 

And I get results with this OData URL:

 http://localhost/acumatica2021r1/odata/production/Invoice  Lines?$filter=Customer eq 'ABC Studios Inc'
image

 

But, when I try to use the contains function like this:

 http://localhost/acumatica2021r1/odata/production/Invoice  Lines?$filter=contains(Customer,'ABC')
image

 

I get this error message:

An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed.

 

Any ideas?


Reply
Gabriel Michaud
Posts: 60
 Gabriel Michaud
June 11, 2021 4:53 pm
(@gabriel)
Trusted Member
Joined: 5 years ago

Hi Tim,

Acumatica does not support every OData operator; contains, startswith are endswith are not supported.

Velixo has a local OData query processor and we cache the data and do the filtering locally in such cases.


Reply
Tim Rodman
 Tim Rodman
Admin
(@timrodman)
Joined: 10 years ago

Famed Member
Posts: 3193
June 11, 2021 5:05 pm
Reply toGabriel MichaudGabriel Michaud

@gabriel Gotcha. Yet another advantage of Velixo!


Reply
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,526 Topics
  • 10.9 K Posts
  • 29 Online
  • 2,324 Members
Our newest member: Michael Kiley
Latest Post: Pick List report suddenly not splitting on Shipment
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2025 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×