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 / save the data into sha...
Power Apps
Answered

save the data into sharepoint, dates in gallery control

(0) ShareShare
ReportReport
Posted on by 237

 

Hi Community Team,

 

   I created App. My requirement is when user  select "add dates" button dynamically add next 5days except weekends to the screen.

Submit the user data into sharepoint list. onselect of submit button how can write dynamic dates. please help to achieve this one.

Below image for better understand requirement.

 

Powerappsuser11_0-1689567340178.png

 

Dates in gallery how to save those records?

hour and description saved based on date means like date is 17/7.2023,hour and description also same date.

 

Thanks in advance for quick respond and efforts....!!!!

 

Categories:
  • narayan225 Profile Picture
    2,547 Moderator on at

    @Powerappsuser11 

     

    You can use the following link that has a clear explanation and example on how to achieve this:

     

    https://www.matthewdevaney.com/how-to-add-business-days-to-a-date-in-power-apps-excludes-weekends/

     

    Cheers!

  • Powerappsuser11 Profile Picture
    237 on at

    Hi @narayan225 

     

    Thanks for response ,

      I'm able to retrieve  the business days but my issue is onselect of submit button save the gallery records.

    For above reference image shows save the user data but how can save, any  idea please share me

     

    Thanks....

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Powerappsuser11 ,

     

    When creating the dates using Add week button, you should create a collection to include all the dates, and also add blank columns for hours and description. In a Gallery, use this collection as data source. At last, update all Gallery items to SharePoint list using ForAll/Patch method.

     

    Best regards,

  • narayan225 Profile Picture
    2,547 Moderator on at

    @Powerappsuser11 

     

    Please check out the comment by @v-jefferni 

     

    Cheers!

  • Powerappsuser11 Profile Picture
    237 on at

     Hi @v-jefferni ,

    Thanks for response on my issue.

    User by enter values in hour and description text input. only dates are dynamically updated in gallery.

    I written below code on Add days button. Lease rectify below code into my requirement.

    Clear(Next5Days);
    Collect(Next5Days,
    FirstN(Filter(ForAll(Sequence(
    DateDiff(DatePicker4.SelectedDate,DatePicker4.SelectedDate + 7)),
    DatePicker4.SelectedDate + Value-1),
    !(Text(ThisRecord.Value, "dddd") = "Saturday" || Text(ThisRecord.Value, "dddd") = "Sunday")),5)
    )

    Please provide logic on select of submit button.

     

    Thanks in advance

  • Sanshubh Profile Picture
    512 on at

    You can use ForAll function
    I'm assuming you have inserted onlu one Galley for Date,hours and Description field's answers

    ForAll(
    	Gallary1.AllItems,
    	Patch(
    		ListName,
    		Defaults(ListName),
    		{
    			Task:ThisRecord.drpTask.Selected,
    			Project:ThisRecord.drpProject.Selected,
    			Date:ThisRecord.lblDate.Text,
    			Hours:ThisRecord.txtHours.Text,
    			Description:ThisRecord.txtDescription.Text,
     TotalHours:ThisRecord.txtTotalHours.Text
    		}
    	)
    )

    I've written field names based on my assumptions.
    This Code will create 5 Entries in List All Data will be similar Except Date-Hours-Description field and ID.

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Powerappsuser11 ,

     

    You should have only one Gallery to include the dates as well as hours and descriptions. So, to create the collection, you can add another two columns to the Next5Days collection then use is as Gallery data source.

    Clear(Next5Days);
    Collect(Next5Days,
    AddColumns(
    FirstN(Filter(ForAll(Sequence(
    DateDiff(DatePicker4.SelectedDate,DatePicker4.SelectedDate + 7)),
    DatePicker4.SelectedDate + Value-1),
    !(Text(ThisRecord.Value, "dddd") = "Saturday" || Text(ThisRecord.Value, "dddd") = "Sunday")),5)
    ),
    "Hours",Blank(),"Description",Blank()
    )

     

    On the submit button:

    ForAll(
     Gallery.AllItems As GA,
     Patch(
     SPlist,
     Defaults(SPlist),
     {
     Date: GA.Date,
     Hours: GA.HoursTextInput.Text,
     Description: GA.DescriptionTextInput.Text
     }
     )
    )

     

    Best regards,

  • Powerappsuser11 Profile Picture
    237 on at

    Hi @SanshubhLubal 

     

    Thanks for your help

     I only created one gallery for dates.

    user manually enter Hours and description. 

    based on date ,same date hours and description  save in sharepoint list.

    In gallery created labels for dates.

    Please help

  • Powerappsuser11 Profile Picture
    237 on at

     

    Hi @v-jefferni ,

     

    I written below code in on select of  add days but getting below errors.please rectify.

    Powerappsuser11_0-1689581307933.png

     

    Thanks for help.

  • v-jefferni Profile Picture
    Microsoft Employee on at

     

    Clear(Next5Days);
    Collect(Next5Days,
    AddColumns(
    FirstN(Filter(ForAll(Sequence(
    DateDiff(DatePicker4.SelectedDate,DatePicker4.SelectedDate + 7)),
    DatePicker4.SelectedDate + Value-1),
    !(Text(ThisRecord.Value, "dddd") = "Saturday" || Text(ThisRecord.Value, "dddd") = "Sunday")),5)
    ,
    "Hours",Blank(),"Description",Blank()
    )

     

     

    Best regards,

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 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard