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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

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

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,031)