Hi!
I have a custom API using SourceTable=Item and a page part to the Item Ledger and I'm trying to limit the number of records on the Item Ledger API response by using both a Location Filter and a top
https://api.businesscentral.dynamics.com/v2.0/.../items(7250bd46-69b9-ef11-9101-18a90553bf46)?$filter=locationFilter eq 'MAIN'&$expand=itemledgerentries($top=100)
However, the LocationFilter does not apply on the page part, only on FlowFields on Item Table. The filtered response from the page part is only using the ItemNo and not the LocationFilter. Why is that?
page 79126 "FloWMS Items API"
{
...
EntityName = 'item';
EntitySetName = 'items';
PageType = API;
SourceTable = Item;
...
repeater(General)
{
field(id; Rec.SystemId)
{ }
field(no; Rec."No.")
{ }
field(description; Rec.Description)
{ }
field(qtyOnSalesOrder; Rec."Qty. on Sales Order")
{ }
field(locationFilter; Rec."Location Filter")
{ }
part(itemledgerentries; "Item Ledger Entries API")
{
SubPageLink =
"Item No." = field("No."),
"Location Code" = field("Location Filter");
}
}
Another solution might be to use a filter in the expand part of the URL. The expand works fine with just one parameter inside the bracket but not two. What am I missing?
https://api.businesscentral.dynamics.com/v2.0/.../items(7250bd46-69b9-ef11-9101-18a90553bf46)?$filter=locationFilter eq 'MAIN'&$expand=itemledgerentries($filter=locationCode eq 'MAIN'&$top=100)
But this gives me an error:
{
"error": {
"code": "BadRequest",
"message": "Found an unbalanced bracket expression. CorrelationId: 0f3dec82-c1e9-4d2e-9a56-e39ae0f50d33."
}
}
What is the best approach to limit the amount of records from the page part Item Ledger?
Best regard
Jan