cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sajith
Helper IV
Helper IV

Hazard Level having Questionares and labels

The InfoPath form has the  below hazard section. It has got two sections - Left and right which consists of questionares having yes or no dropdown values. Based on the user selection of dropdown values, the level will change from level 1, level 2 and level 3.

 

These questionares are static in the form and is not rendered from any data source. Is it fine to use labels and dropdowns for creating this or is there any specific control can we use in power apps 

 

HazardLevel.png

1 ACCEPTED SOLUTION

Accepted Solutions

The following piece of code is pasted into the Text property of a label and assumes your dropdowns have two choices, either a "Yes" or a "No". There are more elegant ways to express this, but this reads the most intuitively for me:

If(
    Or(
        PHC1.Selected.Choice = "Yes",
        PHC2.Selected.Choice = "Yes",
        PHC3.Selected.Choice = "Yes",
        PHC4.Selected.Choice = "Yes",
        PHC5.Selected.Choice = "Yes",
        PHC6.Selected.Choice = "Yes",
        PHC7.Selected.Choice = "Yes"
    )
    && // If any one from PHC and SPC are both a "Yes"
    Or(
        SPC1.Selected.Choice = "Yes",
        SPC2.Selected.Choice = "Yes",
        SPC3.Selected.Choice = "Yes",
        SPC4.Selected.Choice = "Yes",
        SPC5.Selected.Choice = "Yes",
        SPC6.Selected.Choice = "Yes",
        SPC7.Selected.Choice = "Yes",
        SPC8.Selected.Choice = "Yes"
    ),
    "Level is 3", // Set the label to Level 3

    And( // If all the choices are set to "No"
        PHC1.Selected.Choice = "No",
        PHC2.Selected.Choice = "No",
        PHC3.Selected.Choice = "No",
        PHC4.Selected.Choice = "No",
        PHC5.Selected.Choice = "No",
        PHC6.Selected.Choice = "No",
        PHC7.Selected.Choice = "No",
        SPC1.Selected.Choice = "No",
        SPC2.Selected.Choice = "No",
        SPC3.Selected.Choice = "No",
        SPC4.Selected.Choice = "No",
        SPC5.Selected.Choice = "No",
        SPC6.Selected.Choice = "No",
        SPC7.Selected.Choice = "No",
        SPC8.Selected.Choice = "No"
    ),
    "Level is 1", // Set the label to Level 1

    "Level is 2" // Set the label to Level 2 for all other cases
)

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

7 REPLIES 7
BCLS776
Super User
Super User

From a UI perspective, dropdowns take extra effort for a Yes/No response (at least two taps/clicks). How about a checkbox, radio, or toggle for each? Those can operate with a single tap/click.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

From a UI perspective, your suggestion is valid. As per the count of  user selection, the level will change. The level is a label contol. Can I use the formula  based on if condition.  If the count of yes is more,level will change.

Yes, the Text property of a label can include an If statement to change the displayed text. 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

I am getting confused while making the if condition. Degree of Potential Hazard controls (Left) are from PHC1 to PHC7. Significance of Proposed Change (Right) are from SPC1 to SPC8.

If all values are not selected (No), the level is 1.
If any one control is having yes, it is level 2 (Either left or right)
If there is minimum one yes from left and one minimum yes from right, the level is 3.

 

How  to form the if condition?

The following piece of code is pasted into the Text property of a label and assumes your dropdowns have two choices, either a "Yes" or a "No". There are more elegant ways to express this, but this reads the most intuitively for me:

If(
    Or(
        PHC1.Selected.Choice = "Yes",
        PHC2.Selected.Choice = "Yes",
        PHC3.Selected.Choice = "Yes",
        PHC4.Selected.Choice = "Yes",
        PHC5.Selected.Choice = "Yes",
        PHC6.Selected.Choice = "Yes",
        PHC7.Selected.Choice = "Yes"
    )
    && // If any one from PHC and SPC are both a "Yes"
    Or(
        SPC1.Selected.Choice = "Yes",
        SPC2.Selected.Choice = "Yes",
        SPC3.Selected.Choice = "Yes",
        SPC4.Selected.Choice = "Yes",
        SPC5.Selected.Choice = "Yes",
        SPC6.Selected.Choice = "Yes",
        SPC7.Selected.Choice = "Yes",
        SPC8.Selected.Choice = "Yes"
    ),
    "Level is 3", // Set the label to Level 3

    And( // If all the choices are set to "No"
        PHC1.Selected.Choice = "No",
        PHC2.Selected.Choice = "No",
        PHC3.Selected.Choice = "No",
        PHC4.Selected.Choice = "No",
        PHC5.Selected.Choice = "No",
        PHC6.Selected.Choice = "No",
        PHC7.Selected.Choice = "No",
        SPC1.Selected.Choice = "No",
        SPC2.Selected.Choice = "No",
        SPC3.Selected.Choice = "No",
        SPC4.Selected.Choice = "No",
        SPC5.Selected.Choice = "No",
        SPC6.Selected.Choice = "No",
        SPC7.Selected.Choice = "No",
        SPC8.Selected.Choice = "No"
    ),
    "Level is 1", // Set the label to Level 1

    "Level is 2" // Set the label to Level 2 for all other cases
)

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Thanks a lot for your help. The formula is really complex.

 

For me, PHC1.Selected.Choice did not work. But PHC1.SelectedText.Value worked.

 

 

If Left or right section questionares are updated, added new or deleted in future, how to handle in the Power App Forms.

 

For the new item, it will be fine by creating a new screen. However for the  old items in the Power App Forms, it will change. How to handle this ?

 

 

 

 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,461)