web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error DetailForm with ...
Power Apps
Answered

Error DetailForm with BrowseGallery Sort

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello; 

 

I have a error when i use this code for sort my BrowseGallery : 

My DetailForm display => invalid formula. A value compatible with "datasource" is expected


My list BrowseGallery ('Home Working Test') is a datasource from a SharePoint List

 

 

If(
     UserEmail in UserAdmin.Value;
     SortByColumns(
          AddColumns(
               Filter(
                    'Home Working Test';
                    StartsWith(
                         Requester.DisplayName;
                         TextSearchBox1.Text
                    )
               );
               "itemchoice";
               If(
                    Status_Request.Value = "Requested";
                    "A"
               )
          );
          "itemchoice";
          "Ascending";
          "Title";
          If(
               SortDescending1;
               Descending;
               Ascending
          )
     );
     SortByColumns(
          AddColumns(
               Filter(
                    'Home Working Test';
                    Requester.Email = UserEmail;
                    StartsWith(
                         Requester.DisplayName;
                         TextSearchBox1.Text
                    )
               );
               "itemchoice";
               If(
                    Status_Request.Value = "Requested";
                    "A"
               )
          );
          "itemchoice";
          "Ascending";
          "Title";
          If(
               SortDescending1;
               Descending;
               Ascending
          )
     )
)

 

Sans titre2.PNG

 

Thanks for help ! 🙂 

Categories:
  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    The AddColumns() is causing the issue. It creates a temporary table that is used in the gallery. So gallery.Selected points to a row on the temporary table and not a record in the 'Home Working Test' data source. In your case you may not need AddColumns() because you could just add a label to the gallery that displays "A" if thisitem.Status_Request.Value = "Requested".

     

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    HI @Anonymous ,

    Based on the issue that you mentioned, I think this issue is related is related to AddColumns function. The BrowseGallery1.Selected formula returns an record from the AddColumns formula result, but the Item property of the Display form is required to provide an record value from your 'Home Working Test' data source.

     

    As an fixed solution, please consider take a try with the following workaround:

    Set the Item property of the Display form to following:

    LookUp('Home Working Test', ID = BrowseGallery1.Selected.ID)

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard