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
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,019)