Skip to main content

Notifications

Community site session details

Community site session details

Session Id : t5i164oIOVA9S3aYuVl0cw
Power Apps - Building Power Apps
Unanswered

Sorting Document Library on Created By and Modified by fields

Like (1) ShareShare
ReportReport
Posted on 17 Oct 2024 13:38:35 by 22
Hi All,

I have a gallery connected to a Sharepoint Document Library and I would like to sort the gallery based on the Modified By or Created By Fields.

The following formula is producing an error for Modified By when I add the "Editor" Field to the Sort.  (Error: Cannot Sort on the Expression Type)
 
SortByColumns(Filter(Documents,'File Type - Original' = "Manual" || 'File Type - Original' = "Instructions"
|| 'File Type - Original' = "Template"),"Editor",
If(locSortLoaderDescending,SortOrder.Descending,SortOrder.Ascending))
 
The "ThisItem" for the field in the gallery is :
 
ThisItem.'Modified By'.DisplayName
 
Again, this does not work when "Modified By'.DisplayName" is hard coded into the formula. 

(Error:Specific Column "Modified By'
.DisplayName"  does not exist).

When I try to figure the Sharepoint FileType by clicking sort in the document library it uses " Editor"

(&sortField=Editor&viewid).

Can anyone help me with this and provide the code for Modified By and Created By.

Many Thanks
Jamie


 
Categories:
  • WarrenBelz Profile Picture
    146,947 Most Valuable Professional on 24 Oct 2024 at 23:59:35
    Sorting Document Library on Created By and Modified by fields
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    146,947 Most Valuable Professional on 18 Oct 2024 at 00:55:58
    Sorting Document Library on Created By and Modified by fields
    Try this
    SortByColumns(
       AddColumns(
          Filter(
             Documents,
             'File Type - Original' = "Manual" || 
             'File Type - Original' = "Instructions" || 
             'File Type - Original' = "Template"
          ),
          ModSort,
          'Modified By'.DisplayName
       ),
       "ModSort",
       If(
          locSortLoaderDescending,
          SortOrder.Descending,
          SortOrder.Ascending
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 58

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 42 Super User 2025 Season 1

Overall leaderboard
Loading started