cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ton_s
Frequent Visitor

Radio button: hide item if 3 days left until specified date

Hi,

I have a Radio button inside Gallery and Sharepoint list as a data source. (See att screenshot).

Is it possible to hide/disable/filter one of the item if 3 days left until e.g. Event Date 1, Event Date 2 and Event Date 3 ?

So the user can choose only relevant date. And if there is no relevant date left - show Label with text "Registration ended".

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
BrianS
Super User
Super User

If you want to "Hide" items in a table you need to Filter out the ones you do not want to see. Not exactly sure how your data is shaped. If you are deriving those three dates from somewhere else maybe you could put them in a Table in the Gallery, and then Filter that. Then you just need to have an If statement to Filter for when the dates are all blank. Something like:

With({tbl_Dates:Filter(
         Table(
         { EventDate: Date1,Text:""},
         { EventDate: Date2,Text:""},
         { EventDate: Date3,Text:""}),
                   DateDiff(Today(),EventDate)>3)},
If(IsEmpty(tbl_Dates),Table({EventDate:Date(2060,4,25),Text:"Sorry No Dates"}),tbl_Dates))

 

Then in the Visible property of the label that is displaying the EventDate use:

EventDate<>Date(2060,4,25)

That will keep that date from displaying and just show the "No Dates" message

View solution in original post

5 REPLIES 5
BrianS
Super User
Super User

You can use the DateDiff function to compare the current date to the Event Date. Here is the documentation.

Without knowing the rest of the code, something like:

If(DateDiff(Now(),ThisItem.'Event Date 1')>=3)

Will evaluate to true for Events to show. That could be used in a Visible property or evaluated for each event to be put in the table.

ton_s
Frequent Visitor

thanks! I forgot to add that Radio is inside Gallery.

Here is the working code:

 

[
    If(DateDiff(Now(),DateValue(ThisItem.'Event Date 1'))>=3, ThisItem.'Event Date 1'),
    If(DateDiff(Now(),DateValue(ThisItem.'Event Date 2'))>=3, ThisItem.'Event Date 2'),
    If(DateDiff(Now(),DateValue(ThisItem.'Event Date 3'))>=3, ThisItem.'Event Date 3')
]

 

But I don't know how to completely hide button/row (not only the text):

Screenshot 2022-03-25 004930.png

Any suggestions?

BrianS
Super User
Super User

If you want to "Hide" items in a table you need to Filter out the ones you do not want to see. Not exactly sure how your data is shaped. If you are deriving those three dates from somewhere else maybe you could put them in a Table in the Gallery, and then Filter that. Then you just need to have an If statement to Filter for when the dates are all blank. Something like:

With({tbl_Dates:Filter(
         Table(
         { EventDate: Date1,Text:""},
         { EventDate: Date2,Text:""},
         { EventDate: Date3,Text:""}),
                   DateDiff(Today(),EventDate)>3)},
If(IsEmpty(tbl_Dates),Table({EventDate:Date(2060,4,25),Text:"Sorry No Dates"}),tbl_Dates))

 

Then in the Visible property of the label that is displaying the EventDate use:

EventDate<>Date(2060,4,25)

That will keep that date from displaying and just show the "No Dates" message

ton_s
Frequent Visitor

Thanks you! It's working:

2022-03-28 10_44_27-Window.png

 

But I can't hide Label, if the dates are not blank:

2022-03-28 02_17_53-Window.png

 

 

BrianS
Super User
Super User

That was the point of using a specific date far in the future - that way you can check for that date to hide or show the Message 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,746)