Skip to main content

Notifications

Microsoft Dynamics NAV forum
Answered

Displaying query on a page

Posted on by Microsoft Employee

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

Categories:
  • Community Member Profile Picture
    Community Member Microsoft Employee 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?

  • Verified answer
    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.

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

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans