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 / update a sharepoint li...
Power Apps
Unanswered

update a sharepoint list with dates and the dates between them

(0) ShareShare
ReportReport
Posted on by 14

Hello,

 

I have 2 date pickers: from and to. I want a new entry in a SharePoint list to be created for these two dates and the dates in between as soon as I click on a button.

 

For example:

 

from = 11/27/2023

until = 12/08/2023

powerpatch_0-1701081410636.png  

 

 

If I now click the button, a separate entry should be created in a sharepoint list for the dates 11/27/2023, 11/28/2023, 11/29/2023, 11/30/2023, 12/01/2023, 12/04/2023, 12/05/2023, 12/06/2023, 12/07/2023, 12/08/2023 Saturdays and Sundays should be excluded.

 

Is this possible?

 

Thank you

Categories:
I have the same question (0)
  • Ali_Sheraz_77 Profile Picture
    141 on at

    Hi ,
    [

    set variable on datepicker OnSelect Property 

    Set(Var_date, Self.SelectedDate);

    and use this code on default property of datepicker 

    here weekday 1 is for sunday and weekday 7 is for saturday 

    DefaultDate: If(Weekday(varDate) =1 || Weekday(varDate) =7, Blank(), varDate)

    ]

    Accept the solution if it is helpful.

    Regards
    Ali Sheraz

  • WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    Hi @powerpatch ,

    This should create the records you need

    ForAll(
     Sequence(
     DateDiff(
     vonDatePickerName.SelectedDate,
     bixDatePickerNamedpToList.SelectedDate
     ) + 1
     ),
     Patch(
     SPListName,
     Defaults(SPListName),
     {
     YourDateField: 
    			DateAdd(
     vonDatePickerName.SelectedDate,
     Value - 1,
     TimeUnit.Days
     )
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • powerpatch Profile Picture
    14 on at

    I have implemented your code. But when i click the button nothing happens. I dont get a error either. Do you know what the problem here is?

     

     ForAll(
     Sequence(
     DateDiff(
     DatePicker2.SelectedDate;
     DatePicker3.SelectedDate
     ) + 1
     );
     Patch(
     tbl_Status;
     Defaults(tbl_Status);
     {
     Vorname: ThisItem.Vorname;
     Nachname: ThisItem.Nachname;
     Datum: DateAdd(DatePicker2.SelectedDate; Value - 1; TimeUnit.Days);
     Bemerkung: TextInput5.Text;
     Gruppe: ThisItem.Gruppe.Value
     }
     )
     );;

    Thank You

  • WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    @powerpatch ,

    I tested the code I posted here and it produces all the new records, so the next question is where are you running this from and how does ThisItem relate to the record to be produced ?

    ForAll(
     Sequence(
     DateDiff(
     DatePicker2.SelectedDate;
     DatePicker3.SelectedDate
     ) + 1
     );
     Patch(
     tbl_Status;
     Defaults(tbl_Status);
     {
     Vorname: ThisItem.Vorname;
     Nachname: ThisItem.Nachname;
     Datum: 
     DateAdd(
     DatePicker2.SelectedDate; 
     Value - 1; 
     TimeUnit.Days
     );
     Bemerkung: TextInput5.Text;
     Gruppe: ThisItem.Gruppe.Value
     }
     )
    );;
  • powerpatch Profile Picture
    14 on at

    Thats the german syntax. I get ThisItem out of a gallery (tbl_MA) and want to produce new records with this data and the dates in another table (tbl_Status).

  • WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    @powerpatch ,

    Which of those controls are inside and which are outside the gallery you are running this code from ?

  • powerpatch Profile Picture
    14 on at

    ThisItem and the Button is inside the gallery, the two datepickers are outside the gallery.

  • powerpatch Profile Picture
    14 on at

    i got it now to work, but how can i exclude saturdays and sundays?

  • WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    @powerpatch ,

    Sorry will have to leave that one - had a go in a model, but could not get it.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard