Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Sorting of Job List page in descending order

(0) ShareShare
ReportReport
Posted on by 700

Hi All,

I am trying to sort the job list page in descending order. As it is a page extension, I am unable to use SourceTableView property on it. So, I have used RunPageView property on the rolecenter page. But, this property is not sorting the list page for those profiles for which there are filters applied on Job List page (for some roles, we have restricted to view certain jobs based on some criteria).

We have used such filters on the list page, providing the code snippet for reference :-

  appKeyTableForAdmin.Reset();
        appKeyTableForAdmin.SetFilter(code'GROUP3');   
        if appKeyTableForAdmin.FindSet() then begin
            repeat
                userMember.SetFilter("User Security ID", User."User Security ID");
                if userMember.FindFirst() then begin
                    repeat
                        if (userMember."User Group Code" = appKeyTableForAdmin.Namethen begin
                            if jobAdmin.FindSet() then begin

                                empBU.SetFilter("AD user name", UserId);
                                if empBu.FindSet() then begin

                                    jobBUHead.Reset();
                                    jobBUHead.FilterGroup(2);
                                    jobBUHead.SetFilter(JobDepartment, Format(empBu.Department));
                                    if jobBUHead.FindFirst() then begin end;
                                    jobBUHead.FilterGroup(0);
                                    SetRecord(jobBUHead);
                                    SetTableView(jobBUHead);
                                    exit;
                                end;
                            end;
                            exit;
                        end
                    until userMember.Next() 0;
                end;
            until appKeyTableForAdmin.Next() 0;
        end;

Could anyone please provide me a solution for the issue !

Thanks !!

Categories:
  • Dynamics 365 Business Central Profile Picture
    700 on at
    RE: Sorting of Job List page in descending order

    Thanks Jamal, it helped..

  • Verified answer
    jbakach Profile Picture
    85 on at
    RE: Sorting of Job List page in descending order

    Exactly, that's the example that I was going to send you.

    It depends on which record you were selected. Try to do a findfirst after ascending, inside an if, or you will be getting an error if no record found.

    FilterGroup(2);

                  Ascending(false);

    If findfirst then ;

    FilterGroup(0);

  • Dynamics 365 Business Central Profile Picture
    700 on at
    RE: Sorting of Job List page in descending order

    I used

    FilterGroup(2);

                   Ascending(false);

    FilterGroup(0);

    It is serving my purpose but setting the cursor to the last record. Can I set it to first record ??

  • Dynamics 365 Business Central Profile Picture
    700 on at
    RE: Sorting of Job List page in descending order

    I didn't get you completely. Could you please elaborate ! Is the change related to the code snippet I provided ? Please suggest the modification needs to be done

  • jbakach Profile Picture
    85 on at
    RE: Sorting of Job List page in descending order

    Try it out, just use the same filtergroup as the page to override the sourcetableview sorting.

    [quote user="Dynamics 365 Business Central"]

    No, I haven't tried this. Although I had used setcurrentkey and setascending, which did not work.

    [/quote]
  • Dynamics 365 Business Central Profile Picture
    700 on at
    RE: Sorting of Job List page in descending order

    No, I haven't tried this. Although I had used setcurrentkey and setascending, which did not work.

  • Suggested answer
    jbakach Profile Picture
    85 on at
    RE: Sorting of Job List page in descending order

    Have you tried to use Trigger OnOpenPage in pageextension and use Ascending(False)?

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 > Small and medium business | Business Central, NAV, RMS

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans