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 / 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:
I have the same question (0)
  • narayan225 Profile Picture
    2,547 Super User 2025 Season 2 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
    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 Super User 2025 Season 2 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
    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
    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

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard