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

Need compare 20 fields on lable to get the outcome

We have 20 fields these are mix-match of radio button and dropdown(including multi-select) I use if to calculated result and store them in separate 20 label, and the result is these 4 strings: Low, Medium, High and Critical

12345678910
LowMediumHighCriticalMediumLowCriticalHighHighCritical
11121314151617181920
MediumLowCriticalLowHighCriticalMediumLowHighLow

 

The outcome will be the highest value available or presented on the above table which is Critical, even if we have 19 Low and 1 Critical it makes it to Critical.

 

Many thanks for your help in Advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BrianS
Super User
Super User

The actual syntax will change slightly depending on the control, but say for a radio button,

In the OnChange of each control put:

If(var_FinalState<Radio.Selected.Value, Set(vaf_FinalState, Radio.Selected.Value))

That will set var_FinalState to the larger of it's previous state or the radio button, whichever is larger

Put that formula - or a similar one, depending on the control - in each OnChange event. Then no matter what order they change the controls var_FinalState will always have the greatest value.

For your final value a statement like 

Switch( var_FinalState,

      1, "Medium",

      2, "High",

      3, "Critical")

Will get your text value for your final output

   

View solution in original post

3 REPLIES 3
BrianS
Super User
Super User

I would make the Medium, High and Critical variables that you assign numbers to - 1,2 and 3.  Create a variable to hold the outcome - say var_FinalState, nad set the initial value to 1. Then each time a radio button or dropdown is changed you can compare the value that the control was just set to to the value of var_FinalState and set the new value to the greater of Var_FinalState or the control. That way it will always have the greatest value of any control. When all controls are adjusted yo will have the value you need.

Thanks Brian, I thout about that, how do I compare the 20 variables?

BrianS
Super User
Super User

The actual syntax will change slightly depending on the control, but say for a radio button,

In the OnChange of each control put:

If(var_FinalState<Radio.Selected.Value, Set(vaf_FinalState, Radio.Selected.Value))

That will set var_FinalState to the larger of it's previous state or the radio button, whichever is larger

Put that formula - or a similar one, depending on the control - in each OnChange event. Then no matter what order they change the controls var_FinalState will always have the greatest value.

For your final value a statement like 

Switch( var_FinalState,

      1, "Medium",

      2, "High",

      3, "Critical")

Will get your text value for your final output

   

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (74,150)