powerappspowerapps-canvaspowerapps-formula

How can I set meet condition of selected fields in Power Apps?


I would be pleased if I could get some help here. I created a form with 80 questions included, and each of them has its own "Not Meet Condition" The fields SLY, HLY, TJPY, ANY and EEY are number fields, the default value is blank; QuestionNumberLabel is a dropdown list with the Question Number Listed;

For question 8, I want to show "Not Meet" when SLY/ HLY/ TJPY / ANY / EEY are not blank (That means someone filled with value) and the value of either one of the fields is less than 1.

Now, when I type 1 or more than 1 in the field SLY, the result will show "Not Meet";

but when I type any value in other fields (HLY, TJPY, ANY and EEY), no matter the value, the result is "Not Meet" when there is a value in these fields.

Would you please let me know what is missing? I appreciate your help!

If(
(Value(QuestionNumberLabel.Selected.'Question Number') = 8 && 
(((!IsBlank(SLY.Text)) && Value(SLY.Text)<1) || 
((!IsBlank(HLY.Text)) && Value(HLY.Text) <1) ||
((!IsBlank(TJPY.Text)) && Value(TJPY.Text) <1) ||
((!IsBlank(ANY.Text)) && Value(ANY.Text) <1) ||
((!IsBlank(EEY.Text)) && Value(EEY.Text) <1))),
"Not Meet", "Meet")

Thanks a lot for the comment. It works fine on one question, but if I add one more condition for other questions, for example:

If
((
    Value(QuestionNumberLabel.Selected.Value) = 8 && 
    (
        !IsBlank(SLY.Text) && Value(SLY.Text) < 1
    ) ||
    (
        !IsBlank(HLY.Text) && Value(HLY.Text) < 1
    ) ||     
    (
        !IsBlank(TJPY.Text) && Value(TJPY.Text) < 1
    ) ||     
    (
        !IsBlank(ANY.Text) && Value(ANY.Text) < 1
    ) ||     
    (
        !IsBlank(EEY.Text) && Value(EEY.Text) < 1
    ) || (
    Value(QuestionNumberLabel.Selected.Value) = 9 && 
    (
        !IsBlank(SLY.Text) && Value(SLY.Text) < 1
    ) ||
    (
        !IsBlank(HLY.Text) && Value(HLY.Text) < 1
    ) ||     
    (
        !IsBlank(TJPY.Text) && Value(TJPY.Text) < 1
    ) ||     
    (
        !IsBlank(ANY.Text) && Value(ANY.Text) < 1
    ) ||     
    (
        !IsBlank(EEY.Text) && Value(EEY.Text) < 1
    )),
    "Not Meet",
    "Meet"
)

Then it is not working again.


Solution

  • I am not 100% sure why, but if I remove the unnecessary parenthesis's, the code works as excepted:

    If
    (
        Value(QuestionNumberLabel.Selected.Value) = 8 && 
        (
            !IsBlank(SLY.Text) && Value(SLY.Text) < 1
        ) ||
        (
            !IsBlank(HLY.Text) && Value(HLY.Text) < 1
        ) ||     
        (
            !IsBlank(TJPY.Text) && Value(TJPY.Text) < 1
        ) ||     
        (
            !IsBlank(ANY.Text) && Value(ANY.Text) < 1
        ) ||     
        (
            !IsBlank(EEY.Text) && Value(EEY.Text) < 1
        ),
        "Not Meet",
        "Meet"
    )