cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rsinha
Frequent Visitor

Seat reservation app: Avoid duplicate entry record

Hi Folks,
I am creating an app: "Seat availability at Office" where people can submit their request to come to office date wise as well location wise. Due to this pandemic, we are restricting that only 100 employees can come to office per day (again location-wise).
Conditions are:
1. Person Name and Location fields can not be blank
2. Person can not submit their entry for past days
3. Count should be less than- equal to 100 in a date (Location wise)
I am using following code on SUBMIT request button:
[Data Source: Sharepoint List "Availability at Office Today"]
--------------------------
If(IsBlank(loctionName.SelectedItems.Value) || IsBlank(empName.SelectedItems.DisplayName) || IsEmpty(loctionName.SelectedItems.DisplayName) || IsEmpty(empName.SelectedItems.Value),Notify("Please fill the required fields"),
entryDate.SelectedDate<Today(),Notify("Selected date can not be before Today's date"),
If(CountIf('Availability at Office Today','Location Name'.Value = loctionName.Selected.Value && Date = entryDate.SelectedDate)<=1, SubmitForm(Form1); NewForm(Form1); UpdateContext({Popup: true}),false))
--------------------------
Now we need to implement one more condition: Employee  can never save his/her record against same date and location, we need to prevent the duplicate record on Employee on same date. System should notify that "You have already requested for selected date and location.
Kindly suggest how to achieve this.

1 ACCEPTED SOLUTION

Accepted Solutions
Alex_10
Super User
Super User

@rsinha 

 

If(
IsBlank(loctionName.SelectedItems.Value) ||
IsBlank(empName.SelectedItems.DisplayName) ||
IsEmpty(loctionName.SelectedItems.DisplayName) ||
IsEmpty(empName.SelectedItems.Value),
Notify("Please fill the required fields")
,

entryDate.SelectedDate<Today(),
Notify("Selected date can not be before Today's date")
,

If(IsBlank(LookUp('Availability at Office Today', 'Location Name'.Value = loctionName.Selected.Value && Date = entryDate.SelectedDate)),
SubmitForm(Form1);
NewForm(Form1);
UpdateContext({Popup: true}),

Notify("You have already requested for selected date and location.")
)
)

View solution in original post

4 REPLIES 4
KvB1
Solution Specialist
Solution Specialist

You could add another If function where you check if the LookUp for entryDate and empName IsBlank or not

rsinha
Frequent Visitor

Hi @KvB1 

Thank you for suggestion, I did try to achieve the same by using If and Lookup, but couldn't achieve the same, could you please guide.
I need to prevent the user to enter the duplicate record.
If you could share some code example, that'd be very helpful.

Alex_10
Super User
Super User

@rsinha 

 

If(
IsBlank(loctionName.SelectedItems.Value) ||
IsBlank(empName.SelectedItems.DisplayName) ||
IsEmpty(loctionName.SelectedItems.DisplayName) ||
IsEmpty(empName.SelectedItems.Value),
Notify("Please fill the required fields")
,

entryDate.SelectedDate<Today(),
Notify("Selected date can not be before Today's date")
,

If(IsBlank(LookUp('Availability at Office Today', 'Location Name'.Value = loctionName.Selected.Value && Date = entryDate.SelectedDate)),
SubmitForm(Form1);
NewForm(Form1);
UpdateContext({Popup: true}),

Notify("You have already requested for selected date and location.")
)
)

View solution in original post

rsinha
Frequent Visitor

It seems working, thank you @Alex_10 

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,343)