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!
Solved! Go to Solution.
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
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.
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):
Any suggestions?
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
Thanks you! It's working:
But I can't hide Label, if the dates are not blank:
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