Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Sort with and without Hyphen

(1) ShareShare
ReportReport
Posted on by 4,507
I am pulling two fields from a SharePoint list.

There are times when one of the fields (Show_Name) is empty in SharePoint.

When there is no data in Show_Name I want the first sort (which leaves out the " - " (hyphen).

Else show both fields with hyphen.

What am I missing?
 
If(IsBlank(col_Event_Data_Collection,Show_Name,
Sort(Distinct(col_Event_Data_Collection,Title),SortOrder.Ascending),
Sort(Distinct(col_Event_Data_Collection,Title &" - "& Show_Name),SortOrder.Ascending)

  • timl Profile Picture
    timl 33,713 on at
    Sort with and without Hyphen
     
    If you want to sort col_Event_Data_Collection based on a data set where some rows contain Show_Name and others don't, you might want to consider something like this:
     
    Sort(
       Distinct(
          AddColumns(
              col_Event_Data_Collection,
              DisplayTitle,
              If(
                  IsBlank(Show_Name),
                  Title,
                  Title & " - " & Show_Name
              )
          ),
          DisplayTitle
       ),
       Value
    )

    ​
  • iAm_ManCat Profile Picture
    iAm_ManCat 18,112 on at
    Sort with and without Hyphen
    IsBlank(col_Event_Data_Collection
    ^missing a closing bracket, also only referring to the collection but your description said to only do it when show_name is blank
     
    Should be something like this:
    If(
       IsBlank(Show_Name),
       Sort(Distinct(col_Event_Data_Collection,Title),SortOrder.Ascending),
       Sort(Distinct(col_Event_Data_Collection,Title &" - "& Show_Name),SortOrder.Ascending)
    )
     
    Cheers,
    Sancho

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard