Dynamics 365 Business Central: QueryCategory property – Smartlist? (Execute Queries from Pages)

Dynamics 365 Business Central

Hi Readers.
This morning I had the honor to read the new blogs of Mr. Stefano Demiliani and Mr. Roberto Stefanetti. They all mentioned the QueryCategory property in the Query Object this time.
MS Docs:
QueryCategory Property

Yes this is quite hidden. In simple terms, it allows the queries to be displayed on the page, so that you can now execute a query object from a page. As we all know that the efficiency of Query is much higher than that of Page, which is a very good feature.
In the standard feature of Business Central:

PS:
I once contacted Microsoft to ask if these queries can be translated. Not so far.

I can’t wait to try it.
First I created a new Query. Then the most important setting is QueryCategory Property. You need to specify the name of the page that this Query needs to display.
Format:

QueryCategory = 'Vendor List', 'Purchase Order List';

All codes:

query 50100 "ZY Purchase Order Query"
{
    Caption = 'ZY Purchase Order Query';
    OrderBy = Descending(Buy_from_Vendor_No_);
    QueryCategory = 'Vendor List', 'Purchase Order List';

    elements
    {
        dataitem(Purchase_Header; "Purchase Header")
        {
            column(Buy_from_Vendor_No_; "Buy-from Vendor No.")
            {
            }
            column(Buy_from_Vendor_Name; "Buy-from Vendor Name")
            {
            }
            column(Order_Date; "Order Date")
            {
            }
            column(Amount_Including_VAT; "Amount Including VAT")
            {
            }
            dataitem(Purchase_Line; "Purchase Line")
            {
                DataItemLink = "Document Type" = Purchase_Header."Document Type",
                "Document No." = Purchase_Header."No.";
                column(No_; "No.")
                {
                }
                column(Description; Description)
                {
                }
                column(Quantity; Quantity)
                {
                }
                column(Amount; Amount)
                {
                }
                dataitem(Item; Item)
                {
                    DataItemLink = "No." = Purchase_Line."No.";
                    column(Inventory; Inventory)
                    {
                    }
                }
            }
        }
    }
}

Publish it.

Sign in to Business Central. You can immediately execute the query from the specified pages.

If you are interested, you can also read their blog directly.
Dynamics 365 Business Central: new features for performant code
Business Central Execute Queries from Pages

END

Hope this will help.

Thanks

コメント

タイトルとURLをコピーしました