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 / Triggering one of two ...
Power Apps
Unanswered

Triggering one of two "reservations" buttons based on "time" of the booking

(0) ShareShare
ReportReport
Posted on by 48

I have an app, where I book slots. I managed to create a gallery where I have

 

- Sort + filter ´bookings´ showing active rows and belonging to the user accessing the App

- The booking has ´startDate´and ´endDate´

 

- I successfully added a formulation that if the booking is within 24hrs then it won´t allow

 

If(
DateDiff(Gallery.Selected.BookingDateTime, Now(), Hours) >= 24,
Patch(
YourDataSource,
LookUp(YourDataSource, ID = Gallery.Selected.ID),
{Status: "Inactive"}
),
Notify("Cannot deactivate booking less than 24 hours in advance.", NotificationType.Error)

 

I am trying to add a new "visible" variable that will show one of 2 buttons to manage the booking.

E.g. I have a Booking for the tenth of October: 10.10.2024

  1. 1. Until midnight before the booking day, meaning until 09.10.2024  23:59, I will show button "A"
  2. 2. after midnight, i.e. on the day of validity so from 10.10.2024 00:00, I will show button "B"

thank you for the help

Categories:
  • WarrenBelz Profile Picture
    156,954 Most Valuable Professional on at

    Hi @FaroukM ,

    Assuming this button is in the gallery - Visible on Button A

    ThisItem.BookingDateTime < Today()

    Button B Visible (there are a few other options here)

    Text(ThisItem.BookingDateTime, "dd/mm/yyyy") = Text(Today(), "dd/mm/yyyy")

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • CU18061035-1 Profile Picture
    Microsoft Employee on at

    hey @FaroukM 

     

    try this please in the onvisible of your gallery screen:

    Set(
     ButtonToShow,
     If(
     Now() < DateValue(Text(Gallery.Selected.startDate, "[$-en-US]mm/dd/yyyy")) + Time(0, 0, 0),
     "A",
     "B"
     )
    )

     

    Visible of Button A:

    "A"

     

    Button B:

    "B"

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

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

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard