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 / Need to add another co...
Power Apps
Answered

Need to add another condition to my sort by columns

(0) ShareShare
ReportReport
Posted on by 183

Hi All,

 

I need to add another column to sort by in my app and not sure how to go about it.  Code listed below

 

Need to Add column: Approved = Yes

 

If(varMode = "View All", SortByColumns(Filter([@'Master Chemical List'], StartsWith('Chemical Number', TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending)), SortByColumns(Filter([@'Master Chemical List'], PAC.Value = varMode, StartsWith('Chemical Number', TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending)))

 

Categories:
I have the same question (0)
  • Verified answer
    eka24 Profile Picture
    20,925 on at

    Try:

    If(varMode = "View All", SortByColumns(Filter([@'Master Chemical List'], StartsWith('Chemical Number', TextSearchBox1.Text),Approved="Yes"), "Title", If(SortDescending1, Descending, Ascending)), SortByColumns(Filter([@'Master Chemical List'], PAC.Value = varMode, StartsWith('Chemical Number', TextSearchBox1.Text),Approved="Yes"), "Title", If(SortDescending1, Descending, Ascending)))

     

    OR

     


    If(varMode = "View All", SortByColumns(Filter([@'Master Chemical List'], StartsWith('Chemical Number', TextSearchBox1.Text),Approved=1), "Title", If(SortDescending1, Descending, Ascending)), SortByColumns(Filter([@'Master Chemical List'], PAC.Value = varMode, StartsWith('Chemical Number', TextSearchBox1.Text),Approved=1), "Title", If(SortDescending1, Descending, Ascending)))

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • burliad Profile Picture
    183 on at

    That did it, thank you so much!  had to use the Approved =1

  • burliad Profile Picture
    183 on at

    I'm getting an incompatibility error with the code because its expecting text and not a number.  Looks like everything still works, will this be a problem if I keep it that way or should I use a Text Function to convert it?

  • Verified answer
    Jessie Chen Profile Picture
    on at

    @burliad this should not be a problem as it will still get results.

     

    Best Regards,

     

    Jessie Chen

     

    Support Engineer

    Asia Dynamics 365 Support

    Customer Services and Support

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard