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

How do I set a filter based on selected row

(0) ShareShare
ReportReport
Posted on by 15

I have a page with a list of employees (image 1). When I double-click one of them, a page with detailed info shows up (image 2). On that page, I can press a button to generate a document containing some of that info, but I can't make the nav get the correct employee code (id). It always gets the first employee id or the one I set the filter to in the request page (image 3), but I want it the filter to be set automatically based on the employee I picked from the list or to access that value inside the code. How do I do this? I've covered all the unnecessary info on the pages. 

4405.png2678.png

3036.png

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: How do I set a filter based on selected row

    The selected Employee record is under the REC variable (current record on the Card page). You need to pass Rec. "Nr." to your report:

    YourReport.SETTABLEVIEW(Rec);

    YourReport.RUN;

  • vali98 Profile Picture
    15 on at
    RE: How do I set a filter based on selected row

    Your answer helped me find the complete solution. Thank you!

    I had to:

    1. add the following code to the <Adeverinta> - OnAction() trigger.

    YourTable.RESET;
    YourTable.SETRANGE(TheTableYouGetDataFrom."FieldName", "FieldName");
    IF YourTable.FINDFIRST THEN BEGIN
        YourReportSETTABLEVIEW(YourTable);
        YourReport.RUN;
    END;

    2. set the RunObject property of <Adeverinta> to <Undefined>.

    3. Create the following variables in Page 5200 Employee Card:

    Name           DataType    SubType

    YourReport  Report         <Select the report you want from the list>

    YourTable    Record        <Select the table you want from the list>

    PS: I think <Adeverinta> is the name of the button that creates the report.

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 4,160

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,943

#3
Sumit Singh Profile Picture

Sumit Singh 2,823

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans