cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sjcitpro
Helper III
Helper III

Combining SortbyColumns and First

Non working formula:

UpdateIf(varCandidates,ID in Split(First(SortByColumns('Staffing List'),"Title",Ascending).CandidateIDs,"-"),{ProjectLinked:1}))

 

I am trying to retrieve the first record of a list ('Staffing List') sorted by Title then update varCandidates.ProjectLinked:1  if varCandidates.ID in 'Staffing List'.CandidateIDs

 

Example of 'Staffing List'.CandidateIDs is "10-43-40-"

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @sjcitpro ,

Based on the formula that you mentioned, I think there is something wrong with the SortByColumns() function in your UpdateIf() function.

I have made a test on my side, please take a try to modify your formula as below:

UpdateIf(
varCandidates,
ID in Split(First(SortByColumns('Staffing List',"Title", Ascending)).CandidateIDs, "-"),
{ProjectLinked:1}
)

Or

UpdateIf(
         varCandidates,
         ID in Split(First(SortByColumns('Staffing List',"Title", Ascending)).CandidateIDs, "-").Result,
         {ProjectLinked:1}
        )

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

 

More details about the SortByColumns function in PowerApps, please check the following article:

SortByColumns function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
HadynM
Kudo Kingpin
Kudo Kingpin

Hi @sjcitpro 

It looks like you have a closing bracket in the wrong place for you SortByColumns function.  Try:

UpdateIf(varCandidates,ID in Split(First(SortByColumns('Staffing List',"Title",Ascending)).CandidateIDs,"-"),{ProjectLinked:1})

Cheers Hadyn

v-xida-msft
Community Support
Community Support

Hi @sjcitpro ,

Based on the formula that you mentioned, I think there is something wrong with the SortByColumns() function in your UpdateIf() function.

I have made a test on my side, please take a try to modify your formula as below:

UpdateIf(
varCandidates,
ID in Split(First(SortByColumns('Staffing List',"Title", Ascending)).CandidateIDs, "-"),
{ProjectLinked:1}
)

Or

UpdateIf(
         varCandidates,
         ID in Split(First(SortByColumns('Staffing List',"Title", Ascending)).CandidateIDs, "-").Result,
         {ProjectLinked:1}
        )

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

 

More details about the SortByColumns function in PowerApps, please check the following article:

SortByColumns function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,060)