web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Nested If-statement co...
Power Apps
Answered

Nested If-statement confusions

(0) ShareShare
ReportReport
Posted on by 254

Hello, 

 

I have following issue submitting the OnSave action:

If(
IsBlank(
LookUp(
Products;
ProductID = DataCardValue3.Text
)
) && SharePointForm1.Mode = FormMode.New;
SubmitForm(SharePointForm1);
If(
!IsBlank(
LookUp(
Product;
ProductID= DataCardValue3.Text
)
) && SharePointForm1.Mode = FormMode.Edit;
SubmitForm(SharePointForm1);
Notify("ProdcuctID " & DataCardValue3.Text & " is alread in your list";NotificationType.Error)))

I want to have one more condition and don't know where to put it correctly, since the whole action isn't working anymore with a third condition. 

When in FormMode.New I want it to submit form when no duplicates where found. If found than Notify that its already in the list.

 

When in FormMode.Edit I want it to submit data which is found as duplicate (only because the record itself is the duplicate)

 

Now, where to put the third condition?

When duplicate is found notify user "Please enter new numbers with the main input mask!"

 

Hope somone can help me put it this third condition into righ order.

Thank you very much in advance.

Best. 

 

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Applicable88 

    There are 4 possibilities between product found and New mode, The first two are Ok so submit the form, the second two will not submit and will show a notification instead:

     

    With((product: IsBlank(
     LookUp(
     Products; ProductID = DataCardValue3.Text
     )
     );
     newmode: SharePointForm1.Mode = FormMode.New; 
     option1: product && newmode; // No product and new mode
     option2: !product && !newmode; // product found and edit mode
     option3: !product && newmode // product found and new mode
     option4: !product && !newmode// No product found and edit mode 
     };
     If(
     option1 || option2; SubmitForm(SharePointForm1);
     option3; Notify("ProdcuctID " & DataCardValue3.Text & " is already in your 
     list" ;NotificationType.Error
     );
     option4; Notify(
     "Please enter new numbers with the main input 
     mask!";NotificationType.Info
     )
     )
    )

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard