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 Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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 (2,607)