cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Multiple If condition check to submit form

Hi All,


I have fairly a simple requirement to save my form data into sharepoint list however i have multiple checks before i submit my data to sharepoint list. 

So, i have written the code below and let me explain it as to what i would want to achieve through it;

I would first check if my Drop down1 value contains "Deviation" or "Waiver" ,
if true, 
it checks whether another drop down2 equal to Time Based,
it would check for blank values , if true  show an error message and if not submit the form, 
now if above condition is not the case then check for  drop down2 value is Quantity Based 
if true, it would check for blank values, if there is it shows an error message and if not submit form,

if the above is not the condition, then check for drop down3 value as Temporary,

it would check for blank values, if true shows error and if not submit form,

if above is not the case, check for drop down values3 equal to Temporary and drop down2 value equal to Time Based, 
if true, check for blank values, if true  show error or else submit form,

if none of the above is the case , then check for blank values, if true show error or else submit form.
i have written the code for the above scenario but doesn't seem to work do tell me if you can point some mistake out.

If(
    DataCardValue16.Selected.Value = "Deviation" || DataCardValue16.Selected.Value = "Waiver",
    If(
        DataCardValue132.Selected.Value = "Time Based",
        If(
            IsBlank(DataCardValue122) || IsBlank(DataCardValue134) || IsBlank(DataCardValue143) || IsBlank(DataCardValue136) || IsBlank(DataCardValue138) || IsBlank(DataCardValue17),
            Notify(
                "1.Please fill in all the required fields (Applicable for Program, Type of Deviation , Class of Change Type , Deviation/Waiver Validation Date From , Approval Due Date in information tab and Containment/Countermeasures taken,ontainment/Countermeasures Completion Date BY in Corrective Action tab)",
                NotificationType.Error,
                3000
            ),
            SubmitForm(Form1)
        ),
        If(
            DataCardValue132.Selected.Value = "Quantity Based",
            If(
                IsBlank(DataCardValue134) || IsBlank(DataCardValue143) || IsBlank(DataCardValue136) || IsBlank(DataCardValue138) || IsBlank(DataCardValue17),
                Notify(
                    "1.Please fill in all the required fields (Applicable for Program, Type of Deviation , Class of Change Type , Approval Due Date in information tab and Containment/Countermeasures taken,ontainment/Countermeasures Completion Date BY in Corrective Action tab)",
                    NotificationType.Error,
                    3000
                ),
                SubmitForm(Form1)
            ),
            If(
                DataCardValue134.Selected.Value = "Temporary",
                If(
                    IsBlank(DataCardValue124) || IsBlank(DataCardValue132) || IsBlank(DataCardValue143) || IsBlank(DataCardValue136) || IsBlank(DataCardValue138) || IsBlank(DataCardValue17),
                    Notify(
                        "2.Please fill in all the required fields (Applicable for Program, Type of Deviation , Class of Change Type , Deviation/Waiver Validation Date To, Approval Due Date in information tab and Containment/Countermeasures taken,Containment/Countermeasures Completion Date BY in Corrective Action tab)",
                        NotificationType.Error,
                        3000
                    ),
                    SubmitForm(Form1)
                ),
                If(
                    DataCardValue134.Selected.Value = "Temporary" && DataCardValue132.Selected.Value = "Time Based",
                    If(
                        IsBlank(DataCardValue122) || IsBlank(DataCardValue132) || IsBlank(DataCardValue143) || IsBlank(DataCardValue136) || IsBlank(DataCardValue138) || IsBlank(DataCardValue17) || IsBlank(DataCardValue124),
                        Notify(
                            "3.Please fill in all the required fields (Applicable for Program, Type of Deviation , Class of Change Type , Deviation/Waiver Validation Date To, Deviation/Waiver Validation Date From, Approval Due Date in information tab and Containment/Countermeasures taken,ontainment/Countermeasures Completion Date BY in Corrective Action tab)",
                            NotificationType.Error,
                            3000
                        ),
                        SubmitForm(Form1)
                    )
                )
            )
        )
    ),
    If(
        IsBlank(DataCardValue17) || IsBlank(DataCardValue8) || IsBlank(DataCardValue16),
        Notify(
            "4.Please fill in all the required fields (Plant, Approval Due Date in information tab)",
            NotificationType.Error,
            3000
        ),
        SubmitForm(Form1)
    )
)
1 REPLY 1
Mr-Dang-MSFT
Power Apps
Power Apps

Hi @Anonymous ,

One section I found did not have an 'else' statement for the If and would result in no action performed:

If(
                    DataCardValue134.Selected.Value = "Temporary" && DataCardValue132.Selected.Value = "Time Based",
                    If(
                        IsBlank(DataCardValue122) || IsBlank(DataCardValue132) || IsBlank(DataCardValue143) || IsBlank(DataCardValue136) || IsBlank(DataCardValue138) || IsBlank(DataCardValue17) || IsBlank(DataCardValue124),
                        Notify(
                            "3.Please fill in all the required fields (Applicable for Program, Type of Deviation , Class of Change Type , Deviation/Waiver Validation Date To, Deviation/Waiver Validation Date From, Approval Due Date in information tab and Containment/Countermeasures taken,ontainment/Countermeasures Completion Date BY in Corrective Action tab)",
                            NotificationType.Error,
                            3000
                        ),
                        SubmitForm(Form1)
                    )
                )

 

My suggestion for troubleshooting branching actions is to set a variable for the branch you want to test. Set the drop down menus to the values you want, then place a Set() statement as an action in the condition you want to test. Do this one by one until you find out which one is not working.

 

My other suggestion is to explicitly state what property of each of those controls you are trying to check is blank. For instance, if I have a condition for checking if DataCardValue122 is blank, I would check its Text property and not just the control name itself:

IsBlank(DataCardValue122.Text)

 

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,849)