Hi All,
Good Morning All,
I am using On-Prem Business Central.
I have created one query API which used to fetch Item detail along with the Bar code of item, but if any item contains more than one bar code then it is returning duplicate row.
If there any way/condition where i restrict the child data item to fetch single record only. I
I can only use query API here, because later have to add filter on this bar code also like $filter=barcode eq 'XX'.
I just want to return if any any item have barcode then return 1 barcode, else blank string. So which join i need to use here, please suggest me and please have a look on the below code snip.
Does anyone have any idea about it, please share if you have any code snip.
Code :
query 50118 TestQuery
{
QueryType = API;
APIPublisher = 'QueryV2';
APIGroup = 'QueryGroup';
EntityName = 'Item';
EntitySetName = 'Items';
elements
{
dataitem(ItemDetails; Item)
{
column(SystemId; SystemId)
{
}
column(ItemNo; "No.")
{
}
column(Name; Description)
{
}
column(Base_Unit_Price; "Unit Price")
{
}
column(Country_of_Origin; "Country/Region of Origin Code")
{
}
dataitem(Item_Reference; "Item Reference")
{
DataItemLink = "Item No." = ItemDetails."No.", "Unit of Measure" = ItemDetails."Base Unit of Measure";
DataItemTableFilter = "Reference Type No." = filter('BARCODE');
SqlJoinType = LeftOuterJoin;
column(BarCodeNo; "Reference No.")
{
}
}
}
}
}
Thanks for your Help.