Skip to main content

Notifications

Business Central forum

How to Display Query Results in a List Page

(0) ShareShare
ReportReport
Posted on by 326

Is there a tutorial on how to display Query results in a list page? I came across this post by Mark Brummel about using SourceTableTemporary, but it's all written in C/AL. 

https://dynamicsuser.net/nav/b/mark_brummel/posts/tip-35-using-queries-in-pages-amp-reports

Thanks!

Categories:
  • MarisolC Profile Picture
    MarisolC 72 on at
    RE: How to Display Query Results in a List Page

    I have followed everything that you have published but It has been impossible for me to display results in a page, Query works wonderful but when I tried to display my page, shows nothing, not an error.

    If I debug my procedure to see if I'm getting info to populate my page, It shows perfectly but I'm unable to show data in the page.

    I was wondering  if data type must be same for query definition, temporary table and page structure?

    for example, I have vendor id, should I use code[20] as data type or may I use text[20]? I think this can be causing my issues.

    TIA!

  • YUN ZHU Profile Picture
    YUN ZHU 77,069 Super User 2025 Season 1 on at
    RE: How to Display Query Results in a List Page

    Hope this will help.

    https://yzhums.com/4869/

  • Suggested answer
    JAngle Profile Picture
    JAngle 48 on at
    RE: How to Display Query Results in a List Page

    Brief example.

    Create a new table to hold your query.

    Create a new page to show your query. Source to be the created table but as temporary.

    You’ll then need a function to fill the page/run your query and add the results.

    Kind of like this

    page 50000 "Query in a page”

    {

       PageType = List;

       ApplicationArea = All;

       UsageCategory = Administration;

       SourceTable = "Query Table";

       SourceTableTemporary = true;

       Editable = false;

       DeleteAllowed = false;

       InsertAllowed = false;

       layout

       {

           area(Content)

           {

               repeater(Control1)

               {

                   field("Query field 1 Code"; "Query Field 1 Code")

    Procedure SetPageData()

    Var

    Myquery: query MyQuery

    Begin

    while MyQuery.Read() do begin

               NextRowNo := NextRowNo + 1;

               "Entry No." := NextRowNo;

               "Query Field 1 Code" := Myquery.Journal_Template_Name;

    Insert();

    End;

  • DavidW-Brisbane Profile Picture
    DavidW-Brisbane 10 on at
    RE: How to Display Query Results in a List Page

    Hi Stefano, do you have an example of how this is done in Visual Studio with AL? I'm trying to build a list page that shows jobs by customer but uses the Customer name from the Customer table and not the bill-to customer no. in the Jobs table. I have a simple query that returns the data I want to display but I can't find a way to then build this in to a list page.

    PS have your D365 BC Development Quick Start Guide beside me as I'm learning this - well done!

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: How to Display Query Results in a List Page

    You can do the same in AL.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans