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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,116)