web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Displaying query on a page

(0) ShareShare
ReportReport
Posted on by

I made a query which I would like to display on a page. The query works fine and returns a dataset. But I can't seem to be able to display it on a page. My steps where:

  1. Created a working query
  2. Created a table which has only 1 field called 'Entry'
  3. Create a page visible below. Added 'Entry' and connected the query as myQuery
  4. Added this C/AL code to the page

OnOpenPage()
 
myQuery.OPEN;
WHILE myQuery.READ
  DO BEGIN
    NextRowNo := NextRowNo +1;
    Entry := NextRowNo
END;  

myQuery.CLOSE;

But nothing shows up on the page. It only shows 'Entry' column, not the others. Also, there's no data.

Is the correct way to do so? Do I need to assign every field from the query as a global value?

8306.Capture1.PNG

I have the same question (0)
  • Verified answer
    Lars Lohndorf-Larsen Profile Picture
    on at
    RE: Displaying query on a page

    Hello,

    Try to add the following:

    Page Property SourceTableTemporary = Yes

    Then add INSERT; in your loop.

    That should insert the data, but of course only locally (client-side) for the use of the page.

  • Community Member Profile Picture
    on at
    RE: Displaying query on a page

    That helped, but it seems I need to create each column in the table assign every value in the C/AL code. If I show it as in the screenshot (so myQuery.Entry_No on the page) I'm getting an error saying that the column needs to be read first. And if I assign it as a global value, I'll get a column without a name which isn't sortable.

    So in the end, it looks like I can't use reference like myQuery.Entry_No directly on the page. Is that how it supposed to work?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,750

#2
Sumit Singh Profile Picture

Sumit Singh 2,689

#3
YUN ZHU Profile Picture

YUN ZHU 1,987 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans