Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

AL: Get Selected Rows from List of Temp Table

(0) ShareShare
ReportReport
Posted on by 80

Hi there,

I've got a temp table called "TempShoppingList" that's being shown to the user in a new List page. I want to be able to perform an action on items that have been selected in that list. My current action looks like:

action(RaisePO)
            {
                Caption = 'Raise PO';
                Image = "Import";
                Promoted = true;
                PromotedCategory = Process;
                ApplicationArea = All;

                trigger OnAction();
                var
                    Line: Record "TempShoppingList"; // this is the page source table
                begin
                    CurrPage.SetSelectionFilter(Line);

                    if Line.FindSet() then
                        // codeunit.DoThing(Line)
                    else
                        Message('None selected');
                    exit;
                end;
            }

However, regardless of what is selected in the UI - the message stating 'None selected' always shows. I've managed to get the above working for normal out of the box tables, but not with tempoary tables. Is there anything I'm missing? Thanks in advance

  • sjsbls Profile Picture
    sjsbls 80 on at
    RE: AL: Get Selected Rows from List of Temp Table

    Ah, that makes sense. Copying works great, thanks!

  • Verified answer
    TeddyH Profile Picture
    TeddyH 12,864 Super User 2024 Season 1 on at
    RE: AL: Get Selected Rows from List of Temp Table

    Because the temporary table on the page (rec) and the temporary table on the action (Line) are two different variables.

    Try using copy first.

    Line.Copy(Rec,true);

    CurrPage.SetSelectionFilter(Line);

    if Line.FindSet() then

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans