cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HarshJaswal
Frequent Visitor

Get the row from a table in PowerApps having maximum length of the string

Hi All,

 

I have a table in PowerApps with column "Id"  (number column )and "Value" (string column). I want the row from the table where Value column has the maximum length.

For example:

IDValue
1abc
2a
3abcd

 

It should return abcd.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @HarshJaswal ,

This should do it

First(
   Sort(
      AddColumns(
         YourTableName,
         "Longest",
         Len(Value)
      ),
      Longest,
      Descending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @HarshJaswal ,

This should do it

First(
   Sort(
      AddColumns(
         YourTableName,
         "Longest",
         Len(Value)
      ),
      Longest,
      Descending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

HarshJaswal
Frequent Visitor

@WarrenBelz , it worked like a charm. 🙂

HarshJaswal
Frequent Visitor

  1. @WarrenBelz , on the same note, If I want to append the blank spaces in the end of all the the remaining records in the table so that all the records will have length equal to the maximum length. How can we do that?

@HarshJaswal ,

Not easily

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,660)