cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slhangen71
New Member

Determine highest character count of multiple labels

I have 3 labels:

label1

label2

label3

 

I have variables that count characters of each field and store them as following:

varLabelCount1

varLabelCount2

VarLabelCount3

 

I need a formula that will compare each count and return the label name with largest character count. 

Maybe a switch function, nested If’s, etc. 

 

Any ideas for this solution. Thx in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @slhangen71 ,

 

Please see the steps below:

1\ Add 3 labels . 'Label2', 'Lable3' and 'Label4'.

v-xiaochen-msft_0-1616565505288.png

 

2\ Add a button control and set its onselect property to:

Set(varLabelCount1,Len(Label2.Text));Set(varLabelCount2,Len(Label3.Text));Set(varLabelCount3,Len(Label4.Text))

 

3\ Add a lable control and set its Text property to:

If(Max(varLabelCount1,varLabelCount2,varLabelCount3)=Len(Label2.Text),"Label2: "&Len(Label2.Text),Max(varLabelCount1,varLabelCount2,varLabelCount3)=Len(Label2.Text),"Label3: "&Len(Label3.Text),Max(varLabelCount1,varLabelCount2,varLabelCount3)=Len(Label4.Text),"Label4: "&Len(Label4.Text))

 

4\ The result is as follows:

v-xiaochen-msft_1-1616565562469.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

View solution in original post

1 REPLY 1
v-xiaochen-msft
Community Support
Community Support

Hi @slhangen71 ,

 

Please see the steps below:

1\ Add 3 labels . 'Label2', 'Lable3' and 'Label4'.

v-xiaochen-msft_0-1616565505288.png

 

2\ Add a button control and set its onselect property to:

Set(varLabelCount1,Len(Label2.Text));Set(varLabelCount2,Len(Label3.Text));Set(varLabelCount3,Len(Label4.Text))

 

3\ Add a lable control and set its Text property to:

If(Max(varLabelCount1,varLabelCount2,varLabelCount3)=Len(Label2.Text),"Label2: "&Len(Label2.Text),Max(varLabelCount1,varLabelCount2,varLabelCount3)=Len(Label2.Text),"Label3: "&Len(Label3.Text),Max(varLabelCount1,varLabelCount2,varLabelCount3)=Len(Label4.Text),"Label4: "&Len(Label4.Text))

 

4\ The result is as follows:

v-xiaochen-msft_1-1616565562469.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

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