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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prevent duplicate date...
Power Apps
Unanswered

Prevent duplicate date from date pickers to be patched in the table

(0) ShareShare
ReportReport
Posted on by 65

Hello!

 

I'm working on the Travel Expense App. The user is selecting the date range, for example from April 1st to April 5th by using date pickers control: "dateFrom" as date picker nr1, and "dateTo" as the second date picker.

 

This date range April 1st - April 5th is then patched to a Dataverse table "MT_Dates".

 

I would like to prevent the user to enter the same dates as previously, by either disabling those dates from the date picker, or by error message pop up, or some third option. As long as the user is unable to selected the dates that were already patched.

 

The code I'm using to Patch the dates from date pickers is:

 

Patch(
 MT_Dates,
 ForAll(
 Sequence(
 DateDiff(
 dateFrom.SelectedDate,
 dateTo.SelectedDate,
 TimeUnit.Days
 ) + 1
 ),
 {
 'Selected dates': 
 DateAdd(
 dateFrom.SelectedDate,
 Value - 1,
 TimeUnit.Days
 )
 }
 )
)

I have also attached the screens from my app and the screenshot of the Dataverse table, if it helps.

Thank you so much for reading my post and I look forward to your replies!

 

duplicate per diem.jpg

Categories:
I have the same question (0)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard