How to work with filters applied to grid in Acumatica

Hello everybody,

today I want to describe how to work with Filters, that applied to grid in Acumatica page.

For demonstration purposes I'll use Requisition form. 

So, first of all, I want to say that dealing with Filters you'll need .View.GetExternalFilters() method.

At requisition form graph extension you can get it like this:

List<PXFilterRow> filters = Base.Lines.View.GetExternalFilters()?.ToList() ?? new List<PXFilterRow>();

Demonstrated line of code will give you list of applied filters, or empty list, if no filters were applied to grid.

Take not on how filters look like in debugger:

honestly speaking, applied filters look very similarly to applied ODATA protocol. On my grid I have custom column UsrRQOwner, and you see, that word EQ is applied. It stands for Equal.

Second filter is applied by filtering by InventoryID, and as you see, inventoryID uses LIKE. It is not available in ODATA directly, but I'm under impression that Acumatica borrowed idea from ODATA protocol.

So, that basically it. If you need to know in your code, which filters were applied to your data in grid, then GetExternalFilters is your friend.

No Comments

Add a Comment