cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jayant_2203
Helper II
Helper II

Lookup based Condition

Hi All,

 

I am trying to build a small PowerApps Application. This application allows users to submit their training Schedule in a SharePoint List. Below is the SharePoint List View.

Jayant_2203_0-1633334553014.png

Now What i want to achieve is when the user is submitting the data through the form i would like to check if the From Date and Time - To Date and Time have a Training already scheduled , if yes show an error message and if no submit the data. 

From and To Fields are Date and Time Datatype. PowerApps Form Screenshot below.

Jayant_2203_0-1633334768765.png

 

How do I achieve this in PowerApps?

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @Jayant_2203 ,

 

Please try below:

If(
   IsBlank(
        LookUp(
             YourList, 
             Title = TitleDataCardValue.Text 
             && 
             Location = LocationDataCardValue.Text 
             &&
             Or(
                (From >= FromDataCard.Update && From < ToDataCard.Update), 
                (To > FromDataCard.Update && To <= ToDataCard.Update),
                (From <= FromDataCard.Update && To >= ToDataCard.Update)
             )
        ), 
   SubmitForm(Form1), 
   Notify("There is already a training scheduled during this period", NotificationType.Error)
)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-jefferni
Community Support
Community Support

Hi @Jayant_2203 ,

 

Please try below:

If(
   IsBlank(
        LookUp(
             YourList, 
             Title = TitleDataCardValue.Text 
             && 
             Location = LocationDataCardValue.Text 
             &&
             Or(
                (From >= FromDataCard.Update && From < ToDataCard.Update), 
                (To > FromDataCard.Update && To <= ToDataCard.Update),
                (From <= FromDataCard.Update && To >= ToDataCard.Update)
             )
        ), 
   SubmitForm(Form1), 
   Notify("There is already a training scheduled during this period", NotificationType.Error)
)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,882)