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
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

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.

<
Users online (5,102)