Options

Dynamic dynamic filters based on another DataItem level in Query API

sadjad1sadjad1 Member Posts: 2
edited 2024-02-21 in NAV Three Tier
Hi!
Im trying to get this code working but cannot get it to bypass the error I in the attached screenshot. Is there anything that I have missed in the syntax or is this way of setting filters in a Query API basically impossible?

7g6521trd4j6.png
query 50101 "ItemVarBalance API Query"
{
    APIGroup = 'xxx';
    APIPublisher = 'xxx';
    Caption = 'Item Variant Balance API Query';
    APIVersion = 'v1.0';
    EntityName = 'itemVarBalancesQuery';
    EntitySetName = 'itemVarBalanceQuery';
    QueryType = API;

    elements
    {
        dataitem(Location; Location)
        {
            column(locationCode; Code)
            { }
            dataitem(Item_Variant; "Item Variant")
            {
                SqlJoinType = CrossJoin;
                column(itemNo; "Item No.")
                { }
                column(variantCode; Code)
                { }
                dataitem(Item; Item)
                {
                    DataItemLink = "No." = Item_Variant."Item No.";

                    filter(location_Filter; "Location Filter")
                    {
                        ColumnFilter = location_Filter = field(Location.Code); //<<---THIS IS THE FILTER THAT DOES NOT WORK
                    }
                    filter(Variant_Filter; "Variant Filter")
                    {
                        ColumnFilter = Variant_Filter = field(Item_Variant.Code); //<<---THIS IS THE FILTER THAT DOES NOT WORK
                    }
                    column(inventory; Inventory)
                    { }
                    column(qtyonSalesOrder; "Qty. on Sales Order")
                    { }
                }
            }
        }
    }
}

Answers

  • Options
    Developer101Developer101 Member Posts: 528
    What are you trying to achieve with the query?
    United Kingdom
  • Options
    sadjad1sadjad1 Member Posts: 2
    What are you trying to achieve with the query?

    With a Query, I am trying to get the so called "available/sellable" quantity for each Variant per Location Code.
Sign In or Register to comment.