Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Splitting date range to different Sharepoint records

(0) ShareShare
ReportReport
Posted on by 48

Hello there,

I am creating a parking reservation app, where I want the parking spot owner to free his spot (during wfh) for a range of days. 
The tricky thing that I am trying to implement though, is that the range should not be a single record (i.e. available from November 1st to 5th November).
Instead, I want the owner to free the position and on the SharePoint list to record 4 separate records (sorry for the EU dates)

1/11-2/11
2/11-3/11
3/11-4/11
4/11-5/11
So there should not be two columns like this:
Available from | Available to
1/11                 | 5/11

instead what I would like is :
Available from
1/11
2/11

3/11

4/11

 

  • SmoothOperator Profile Picture
    SmoothOperator 48 on at
    Re: Splitting date range to different Sharepoint records

    Thank you very much @rsaikrishna , really appreciate it.

    Your suggestion along with this (powerusers side post) helped me achieve the solution I was looking for! 🙂

  • Verified answer
    rsaikrishna Profile Picture
    rsaikrishna 3,703 on at
    Re: Splitting date range to different Sharepoint records

    @SmoothOperator 

     

    Use DateDiff function to find out the number of day between the date range.

    Documentation link: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

     

    Let us assume, you got 5. Now, you can create a collection with all the required SharePoint list items as below:

     

    // Replace with the DateDiff value

    ClearCollect(colNoOfDays, sequence(5))  

     

    // Creating collection of SP list items to be created

    Collect(colSPItems, ForAll(colNoOfDays, { Title: <SP List Title>, AvailableFrom: DateAdd(AvailableFrom,ThisRecord.Value) })

     

    // This will create 5 items in SP list.

    Collect(<SPList>,colSPItems) 

     

    I did not try in my personal tenant but you can try this approach.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard