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 / Power Apps booking but...
Power Apps
Unanswered

Power Apps booking button for several days in between date pickers: Patch to SharePoint with date and start-time

(0) ShareShare
ReportReport
Posted on by

I'm creating a booking app in which there's two date pickers; a start date (DatePicker_11) and a finishing date (DatePicker_16), and two time slots; a start time and an end time. It connects with a SharePoint page (LRM) where the data is stored. 

 

I want to book several days, with the start date having the start time specified until 8pm, the end date having the end date having a start time of 8am until the specified end time. The in-between dates should have a start time of 8am and an end time of 8pm.

 

The code I have so far for the submit button is as follows but it sets the same start and end time for all entries. There's also a popup with a visibility called _popup that is set to true if the values are left blank which is why there's an if statement;

Set(StarttimeLRM, Hour_16.Selected.Value & ":" & Minute_14.Selected.Value);
Set(EndTimeLRM, Hour_15.Selected.Value & ":" & Minute_15.Selected.Value);

If(Dropdown_6.Selected.Value = "Please Select" ||  IsBlank(Email_10), Set(_popup,true),

ForAll(AddColumns(FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],

DateDiff(DatePicker_11.SelectedDate,DatePicker_16.SelectedDate,Days)+1),

"Day","Day "&(Value+1),"Date",DateAdd(DatePicker_11.SelectedDate,Value,Days)),

Patch(LRM,

Defaults(LRM),

{Title:Resource_6.Selected.Value,

Date_LRM:Date,

Email_LRM:Email_10,

Starttime_LRM:TimeValue("06:00 AM"),

Endtime_LRM:TimeValue("20:00 PM")})

Emma4_0-1598253521357.png

I've also tried microsoft flow after using patch using the update item in SharePoint flow but couldn't get it working.

@powerapps @sharepointguy @WarrenBelz  @mdevaney 

Categories:
I have the same question (0)
  • Pablo Carceller Profile Picture
    on at

    Hello,


    I see you define the values here:

     

    Set(StarttimeLRM, Hour_16.Selected.Value & ":" & Minute_14.Selected.Value);
    Set(EndTimeLRM, Hour_15.Selected.Value & ":" & Minute_15.Selected.Value);

     

    However, I can't see where you send this information to Sharepoint.

     

    Can you with me the code where you do this, and where you get block on flows.

     

    Thank you, Pablo

  • Community Power Platform Member Profile Picture
    on at

    So I wasn't actually using a flow for this code I was just using Patch but the problem is I couldn't set a different start time for the first date and a different end time for the end date. 

     

    These variables aren't sent to the SharePoint yet, they should be but I just can't figure out how to send them separately for the start date and end date.

     

    For example, if I'm booking from the 26th of August until the 29th,
    - the 26th should have a start time of the variable set "StarttimeLRM" and an endtime of "08:00pm"
    - all the in between dates (27th, 28th) should have a start time of "06:00am" and an endtime of "08:00pm"

    - the 29th should have a start time of "06:00am" and an end time of the variable set "EndTimeLRM"

     

    This is the SharePoint site:

     

    Emma4_0-1598429084538.png

     

  • Community Power Platform Member Profile Picture
    on at

    The flow I have that does the job but is by no means the solution is as follows:

    I introduced a second button so when the submit button is pressed a second button comes up asking you to confirm your booking. 

    When you press this button it initiates a flow called LRMNEW.

    Emma4_0-1598429660168.png

    Emma4_1-1598429842528.png

    The flow gets the ID for the list from a data table in the app that's visibility is set to false.

     

     

  • Pablo Carceller Profile Picture
    on at

    Hello,

     

    I have some questions for further investigation:

    Is the flow filling the right values to the SharePoint list?

    If not can you check the values of the collection ( please click on file on the top left and then collections), lets check if the collection is taking the right information

     

    Also,Why on the Patch funcion you aren't using the collection?

    Patch(LRM,

    Defaults(LRM),

    {Title:Resource_6.Selected.Value,

    Date_LRM:Date,

    Email_LRM:Email_10,

    Starttime_LRM:TimeValue("06:00 AM"),

    Endtime_LRM:TimeValue("20:00 PM")}

     


    Thank you, Pablo

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    Hi Pablo,

     

    The patch code along with the flow to change an input in sharepoint works fine. However, this is a messy solution I came up with to work around the problem. Ideally, I would like to have a button that submits a booking for all the dates in between and including the two date pickers. I would like the start date to have a start time of the start time specified and the end date to have an end time specified in the app. I would like all the other start and end times to be filled in 06:00 AM and 08:00 PM respectively. 

     

    I was just hoping someone would be able to create a more smart code than mine 🙂 

     

    Thanks for your help!

  • VineetBhasin Profile Picture
    20 on at

    Hello @Anonymous 

     

    You can use the If statement like below

     

    Starttime_LRM: If(Date = DatePicker_11.SelectedDate, StarttimeLRM, "06:00am"),       // When date equals to start date
    Endtime_LRM: If(Date = DatePicker_16.SelectedDate, EndtimeLRM, "08:00pm"),         // When date equals to end date

     

    -------------------------------------------------------------------
    If this answers your question, please click Accept as Solution.
    If response is helpful, please give it a Thumbs Up.

     

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