Hello world,
I am having trouble with the if Function. I am kinda a newbie in Powerapps...
What I want to achieve :
The user give a grade to his project on 5 standards. Answer can be "High", "medium" or "low". For instance :
Standard 1 : High
Standard 2 : High
Standard 3 : medium
Standard 4 : High
Standard 5 : low
The genaral grade is given by these conditions :
At least 1 High or 3 medium : High Grade
At least 2 Medium (no High) : medium grade
5 low (no medium or high) : Low grade
An image (High, Medium or Low) appears depending on your grade. Obviously, the low situation and the high situation with only one High is easy but I am having trouble to cover all the cases at once... For now I only have been to poorly use the if fonction with && or || but it doesn't work...
Many thanks if you can help me.
Regards,
Solved! Go to Solution.
@Anonymous
I made a mistake on the condition for "Medium". I used an OR condition.
(myScores.High = 0 Or myScores.Medium >=2)
But it should be an AND condition instead.
(myScores.High = 0 And myScores.Medium >=2)
Note: I've edited the original post to make the correction
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
@Anonymous
Where is the information for standards being stored? In a dropdown? In a variable?
@Anonymous
Put this code in the OnChange property of all your dropdowns.
ClearCollect(myStandards,
Dropdown1.Selected.Value,
Dropdown2.Selected.Value,
Dropdown3.Selected.Value,
Dropdown4.Selected.Value,
Dropdown5.Selected.Value
);
Set(myScores,
{
High: CountRows(Filter(myStandards,Value="High")),
Medium: CountRows(Filter(myStandards,Value="Medium")),
Low: CountRows(Filter(myStandards,Value="Low"))
}
);
Set(myGrade,
If(
(myScores.High >= 1 Or myScores.Medium >=3), "High Grade",
(myScores.High = 0 And myScores.Medium >=2), "Medium Grade",
"Low Grade"
)
)
To display the grade you would put this code in a label
myGrade
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
@mdevaney Thanks, it seems to work with the high and medium grade but not the low. I don't understand why.
@Anonymous
I made a mistake on the condition for "Medium". I used an OR condition.
(myScores.High = 0 Or myScores.Medium >=2)
But it should be an AND condition instead.
(myScores.High = 0 And myScores.Medium >=2)
Note: I've edited the original post to make the correction
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
User | Count |
---|---|
162 | |
85 | |
68 | |
63 | |
61 |
User | Count |
---|---|
212 | |
146 | |
93 | |
81 | |
67 |