Business Central Execute Queries from Pages

Business Central Execute Queries from Pages

With the QueryCategory property we can execute a query object from a page (also available in Smartlists) by defining a query in AL; it is possible to declare with a comma separated list where the object can be used, in practice it is added to the list of objects published in the SmartList.

Very powerful and useful for those who often use queries without creating new pages to visualize them (which are obviously read only by design).

QueryCategory property: this property is for internal use only

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-querycategory-property

SCENARIO

Add a query object to “Item List” and Lot. No. Infomation List page

AL CODE

query 50105 “Lot Numbers by Bin RS”

{
    Caption = ‘Lot Numbers by Bin RS’;
    OrderBy = Ascending(Bin_Code);
    TopNumberOfRows = 5000;
    QueryCategory = ‘Item List’, ‘Lot No. Information List’;
    elements
    {
        dataitem(Warehouse_Entry; “Warehouse Entry”)
        {
            column(Location_Code; “Location Code”)
            {
            }
            column(Item_No; “Item No.”)
            {
            }
            column(Variant_Code; “Variant Code”)
            {
            }
            column(Zone_Code; “Zone Code”)
            {
            }
            column(Bin_Code; “Bin Code”)
            {
            }
            column(Lot_No; “Lot No.”)
            {
            }
            column(Serial_No; “Serial No.”)
            {
            }
            column(Unit_of_Measure_Code; “Unit of Measure Code”)
            {
            }
            column(Sum_Qty_Base; “Qty. (Base)”)
            {
                ColumnFilter = Sum_Qty_Base = FILTER(<> 0);
                Method = Sum;
            }
        }
    }
}

Open “Item List”

RESULTS

Queries are added to Query Navigation List Page and available on Smartlist

… A LOT OF QUERIES AVAILABLE AND READY TO USE ON THE BASE APP! ETC. ETC.

…. And many others!!

1 thought on “Business Central Execute Queries from Pages”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: