cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

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
Highlighted
Power Apps
Power Apps

Re: Multiple If condition check to submit form

Hi @jayant1 ,

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,662)