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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

NAV 2018 AL: Open Page based on Temporary Table

(0) ShareShare
ReportReport
Posted on by

Hi,

I have the requirement to open a page with AL, which is based on a temp. table.

I tried the following code:

----------------------------------------------------------------------

UserGroup: Record "MyRecord";
TempTab: Record "Name/Value Buffer" temporary;
PageUserGroups: Page "MyPage";
begin
UserGroup.setrange("myField","myField");
if UserGroup.findset() then0
repeat
TempTab.SetRange(Name,UserGroup."myField2");
if not TempTab.findfirst then begin
TempTab.init;
TempTab.validate(id,TempTab.id + 1);
TempTab.validate(Name,UserGroup."myFiedl2");
TempTab.Insert;
end;
until UserGroup.next=0;

PageUserGroups.SetTableView(TempTab);

PageUserGroups.Caption('My Caption');

PageUserGroups.Editable(false);

PageUserGroups.Run;
end;

Unfortunatelly, this code does not work, the page does not show the records of the temp table.

To open the page with the code does work, but it is not an option since I need to modify the caption of the page and fields after opening:

Page.run(Page::"MyPage",TempTab);

Any help is appreciated.
Michael

*This post is locked for comments

I have the same question (0)
  • I Gusti Made Ari Profile Picture
    3,608 on at

    Try to add SetRecord before run  sample :

    PageUserGroups.SetRecord(TempTab);

    In this case you no need to use settableview unless you want to set some filter

  • Community Member Profile Picture
    on at

    First it was working but somehow it does not work anymore.

    TempTab.Reset;
    Page.run(Page::"myPage",TempTab);

    myPage.SetRecord(TempTab);
    myPage.Caption('User Groups assigned to User' + ' - ' + "User Name");
    myPage.Editable(false);
    myPage.Run;

    The page.run(...) command opens the page correctly...

    The myPage.run opens the page empty, no record show...

    ????

  • Community Member Profile Picture
    on at

    The funny thing is, if the temporary table is really empty then I get the error that the table is empty when running the code myPage.run(). Only if there are records in the table, the page will open empty...

  • I Gusti Made Ari Profile Picture
    3,608 on at

    Sorry , i just realized that this setrecord is not working with temporary table.

    docs.microsoft.com/.../setrecord-function--page-

    Another workaround is , on your page property  set "SourceTableTemporary" to Yes , then put the code to populate the temporary data during OnOpenPage Trigger  of the page.

  • ChazKimRP Profile Picture
    380 on at

    What if you want to then print or archive this data? I.e you opened a page to fill with temp data, but some of that temp data you want to store in a actual table.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,278 Super User 2026 Season 1 on at

    SetTableView will not work for temporary table, you need to create a new function in the Page and in that function you need to add code to insert the data by passing the temporary table. Make sure you set the TableSource of the page as temporary and call the function before running the Run.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
TAHER_El_Mehdi Profile Picture

TAHER_El_Mehdi 2

#1
sliderxb Profile Picture

sliderxb 2

#1
broberts Profile Picture

broberts 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans