It's very valuable to understand these kinds of things, for being able to make small changes and maintenance.
If(
Len(Required_NO_OR_YESDropdown1.Selected.Value)<1 Or Len(RequiredIF_NO_OR_YESDropdown2.Selected.Value)<1 Or Len(Required_NO_OR_YESText1.Text)<1,
false,
If(
ToggleDataCardValue.Selected.Value = "Yes",
Len(ExtraIfYESStatusDropdown.Selected.Value)>1 And Len(ExtraIfYESTextBox1.Text)>1,
true
)
)
Lets go through it step by step:
If(
Len(Required_NO_OR_YESDropdown1.Selected.Value)<1 Or Len(RequiredIF_NO_OR_YESDropdown2.Selected.Value)<1 Or Len(Required_NO_OR_YESText1.Text)<1,
This will check if any of the fields ar empty that are mandatory for both a Yes or No toggle on your radio. You want the control to be invisible if any of these fields are empty, in any situation, so if this test returns true (any or all of the fields are empty), we want the next argument to be false (control is invisible).
After the false, we will have the second argument of the If function, which is what the if function will do if the first argument returns false. In this situation, ALL the mandatory fields for both situations have been filled, and we want to check if the toggle is a Yes or not.
If(
Len(Required_NO_OR_YESDropdown1.Selected.Value)<1 Or Len(RequiredIF_NO_OR_YESDropdown2.Selected.Value)<1 Or Len(Required_NO_OR_YESText1.Text)<1,
false,
If(
ToggleDataCardValue.Selected.Value = "Yes",
If the toggle is set to "Yes", the visibility property of the control relies on whether the extra text box and dropdown have been filled. So if the inner If function finds that the Toggle is set to "Yes", it will return the second argument of the If function.
If(
Len(Required_NO_OR_YESDropdown1.Selected.Value)<1 Or Len(RequiredIF_NO_OR_YESDropdown2.Selected.Value)<1 Or Len(Required_NO_OR_YESText1.Text)<1,
false,
If(
ToggleDataCardValue.Selected.Value = "Yes",
Len(ExtraIfYESStatusDropdown.Selected.Value)>1 And Len(ExtraIfYESTextBox1.Text)>1,
The second argument of the If function will return true if both the Dropdown and Text have been filled, and false if either of them havent. Since the visibility property of a control is also a false or true, leaving it like this is perfectly fine.
When the inner If function does NOT find that the Toggle is set to "Yes", it will jump to the third argument of its function. In this scenario, we will assume that that means the toggle is set to "No". Since we already validated the mandatory fields for both scenarios have been filled (else the outer If function wouldn't have reached the inner If function) we can just return true.
If(
Len(Required_NO_OR_YESDropdown1.Selected.Value)<1 Or Len(RequiredIF_NO_OR_YESDropdown2.Selected.Value)<1 Or Len(Required_NO_OR_YESText1.Text)<1,
false,
If(
ToggleDataCardValue.Selected.Value = "Yes",
Len(ExtraIfYESStatusDropdown.Selected.Value)>1 And Len(ExtraIfYESTextBox1.Text)>1,
true
)
)