Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Flex Office App

(0) ShareShare
ReportReport
Posted on by 691

Hello, I'm trying to create a rather complicated application on Power Apps. The purpose of my application is to reserve an office for a date.

 

I have a SharePoint list that looks like this:

s44_1-1662369204217.png

This SharePoint list stores all office reservations.
"Name" column: Type People Picker (Indicates the name of the person who booked the room)
"Date" column: Type Date (Indicates the date of the reservation, chosen on the calendar screen on power apps)
"Number_Office" column: Number type (Indicates the office number reserved by the user)

 

 

This is how my Power Apps app looks:


My first screen is a calendar screen. I would like that when the user clicks on the "Continue" button, it redirects him to the second screen so that he can reserve an office on the chosen date.

s44_0-1662389027505.png

 

 

 

The second screen contains an image of a room with several desks. When the user has chosen a date on the previous screen, I would like it to automatically redirect him to this page. To choose a desktop, I'd like them to simply click on a blue circle.

s44_3-1662369941672.png

 

 

Thank you in advance for your help. I can't get what I want at all 😞

  • LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at
    Re: Flex Office App

    Well, if you want to remove the time from a date/time value, just use the DateValue function:

    Roverandom_0-1662465443369.png

     

    If you just want to get the time of a date/time value, use the TimeValue function:

    Roverandom_1-1662465575170.png

     

    The IsEmpty function is used to check if a table/collection is empty. For texts/records use IsBlank: Blank, Coalesce, IsBlank, and IsEmpty functions in Power Apps - Power Platform | Microsoft Docs

    But this component sets, by default, StartDate and EndDate to the current date, so both will not be blank.

     

    I hope I was helpfull.

     

  • s44 Profile Picture
    691 on at
    Re: Flex Office App

    Thanks a lot for your help ! Yes I see what you mean. @LuizVicente 

     

    I have a question, what should I remove in this code to only keep the StartDate? (I would like to remove the time, and the EndDate)

    Set(
     selectedDate;
     Calendar_1.StartDate
    );;
    Set(
     selectedEndDate;
     Calendar_1.EndDate
    );;
    Set(
     startTime;
     DateTimeValue(
     Text(
     selectedDate;
     DateTimeFormat.ShortDate
     ) & " " & ddTimeFrom.Selected.Value
     )
    );;
    Set(
     endTime;
     If(
     DateValue(
     Text(
     selectedEndDate;
     DateTimeFormat.ShortDate
     )
     ) < DateValue(
     Text(
     selectedDate;
     DateTimeFormat.ShortDate
     )
     );
     DateTimeValue(
     Text(
     selectedDate;
     DateTimeFormat.ShortDate
     ) & " " & ddTimeTo.Selected.Value
     );
     DateTimeValue(
     Text(
     selectedEndDate;
     DateTimeFormat.ShortDate
     ) & " " & ddTimeTo.Selected.Value
     )
     )
    );;
    If(
     IsEmpty(startTime) && IsEmpty(endTime);
     Notify(
     "You must select a date and time to continue";
     NotificationType.Warning
     );
     Navigate(BrowseScreen1)
    )

     

  • Verified answer
    LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at
    Re: Flex Office App

    I analyzed your app. Some things:
    - This calendar component makes it possible to choose two dates, if you want to keep this default, your SharePoint list needs to have a column for StartDate and another for EndDate. To retrieve the information of the selected dates do:

     

    Start Date = Calendar_1.StartDate
    End Date = Calendar_1.EndDate

     

    - Otherwise, uncheck the "Select Range" option of the component. Then you will have a single date. So, to retrieve this date do:

    Date: Calendar_1.StartDate

     

    I fixed the Patch for room choice:

    Patch(
     Reservation,
     Defaults(Reservation),
     {
     Numero_Bureau: 1, // -> Enter the room name for each blue button here.
     Date: Calendar_1.StartDate
     // If you need to choose two dates, your SharePoint list must have another column, EndDate for example. Therefore:
     // EndDate: Calendar_1.EndDate
     }
    )

     

    Some concerns with your app development:
    - I imagine that the user can choose only one room and finish the app. If so, you can proceed with Patch that way, because the Defaults(Reservation) statement creates a new item in the list. Given this, it would be unfeasible if the user changed his mind and went to choose another room, then you would have several new items in the Reservation list. You understand?

  • s44 Profile Picture
    691 on at
    Re: Flex Office App

    I downloaded an msapp file from the internet ! @LuizVicente 

  • LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at
    Re: Flex Office App

    You are using a component called Calendar_1. We need to see if this component exports any properties with the selected date, for example. Did you create this component or did you download it?

  • s44 Profile Picture
    691 on at
    Re: Flex Office App

    I don't know what is my date picker control. My date is here : 😞

    s44_0-1662389771280.png @LuizVicente 

     

  • LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at
    Re: Flex Office App

    DatePicker is an example, you should change it to the name of the date control you have in your app. So it should be like this:
    yourdatepickercontrol.SelectedDate

  • s44 Profile Picture
    691 on at
    Re: Flex Office App

    Yes I already have "Date" type @LuizVicente 

    s44_0-1662388814673.png

     

  • LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at
    Re: Flex Office App

    Right.
    Check the data type of the SharePoint column that will receive the date value.

     

    Roverandom_0-1662388589367.png

     

  • s44 Profile Picture
    691 on at
    Re: Flex Office App

    In France it is with semicolons. 

     

    s44_0-1662388329460.png

     

    The error is this :

    The type of this argument "Date" does not match the expected type "Date". Type found "Error"

    @LuizVicente 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard