lundi 6 décembre 2021

Powerapps - Nested If Statement, maybe Switch?

I'm trying to achieve the following:

Fill a textinput box in red or green depending on the value entered. It gets a little more complicated as the textinput is in a gallery and I only want it to go red or green if the selected question is 'FR Chlorine' or 'ph Actual'. The input box should be white if it is not one of those two questions.

To determine whether we want to fill in red or in green, there is another if statement which checks the value entered against predetermined variables which hold the comparison values. Can anyone help me to tidy this up as I seem to be in a bit of a pickle somewhere.

If(
    ThisItem.question = "FR Chlorine",
    If(
        Value(txtResult.Text) < ChlorineLowerLevel,
        Red,
        Value(txtResult.Text) > ChlorineUpperLevel,
        Red,
        Green
    ),
    White
);
If(
    ThisItem.question = "ph Actual",
    If(
        Value(txtResult.Text) < phLowerLevel,
        Red,
        Value(txtResult.Text) > phUpperLevel,
        Red,
        Green
    ),
    White
)

Aucun commentaire:

Enregistrer un commentaire