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,868 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,560 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans