The Controller class can be used to retrieve a data grid table, optionally filtered by some criteria, using a convenience method queryDataGrid
For example:
const results = await controller.queryDataGrid({
from: 'SomeMapping',
filter: {
and: [
{
field: 'BU',
op: 'Equal',
value: businessUnit,
},
],
},
take: 10,
skip: 0,
});
The method parameters include:
|
Parameter |
Description |
|---|---|
|
from |
Data grid ID |
|
filter |
Filters to apply to the data grid table |
|
take |
Paging parameters, maximum number of results to return |
|
skip |
Paging parameters, number of rows to skip |
Filter specification
A filter can be one of two forms:
Composite filter
A filter that groups multiple sub-filters under a logical operator (and or or).
{
"and": [
/* array of sub-filters (each sub-filter can be Composite or Leaf) */
]
}
{
"or": [
/* array of sub-filters (each sub-filter can be Composite or Leaf) */
]
}
For example:
{
"and": [
{ "field": "Status", "op": "Equal", "value": "Active" },
{
"or": [
{ "field": "Category", "op": "BeginsWith", "value": "H" },
{ "field": "Priority", "op": "NotEqual", "value": "Low" }
]
}
]
}
Leaf filter
A single condition comparing a field to a value using an operator (op).
{
"field": "<string>",
"op": "<operator>",
"value": <any>
}
Where:
-
field: A string representing the field/property to filter on.
-
op: One of the supported operators (see Supported Operators below).
-
value: The value to compare against (type can vary depending on field and operator).
Supported Operators
Each leaf condition’s op (operator) must be one of:
-
Equal
-
NotEqual
-
BeginsWith
-
NotBeginsWith
-
Contains
-
NotContains
-
EndsWith
-
NotEndsWith
-
IsEmpty
-
IsNotEmpty
-
Less
-
LessOrEqual
-
Greater
-
GreatOrEqual
Combining Filters
-
You can nest composite filters inside each other arbitrarily to create complex logical groupings:
-
A composite filter contains either an and property or an or property (not both), pointing to an array of sub-filters.
-
Each sub-filter in that array can itself be either a Leaf Filter or another Composite Filter.