cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kinghnvn
Helper V
Helper V

Filter previous appointments

Hi,

 

I am looking everywhere for the code to remove item in filter list if [CheckIn = "No"] and [Check Out From Time > Today date] or {[Check Out From Time = Today date] and [DateDiff(ThisItem.FromDateTime, Text(Now(), "hh:mm"), Minutes) > 10]} (passed 10mins).

 

Could you please help?

 

kinghnvn_0-1637884110032.png

 

Default code:

 

SortByColumns(
Filter(
'Desk Reservations',
'Reserved By'.Email = currentUser.Email && 'Check Out From Number' < Value(
Text(
Now(),
"yyyymmddhhmm"
)
)
),
"CheckOutFromNumber",
Descending
)

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Community Champion
Community Champion

Hi @kinghnvn 

 

Please use this. I have optimized the items property of the gallery to

 

SortByColumns(
Filter(
'Desk Reservations',
'Reserved By'.Email = currentUser.Email && 
If(
    VarFilterPrevious,
'Check Out From Number' < Value(Text(Now(),"yyyymmddhhmm")),
'Check Out From Number' >= Value(Text(Now(),"yyyymmddhhmm"))
)
),
"CheckOutFromNumber",
Descending
)

 

 

Result

StalinPonnusamy_0-1637901711267.png

Note: If you have a Datetime Sharepoint column then we can use filter directly instead of converting to text like

SortByColumns(
Filter(
'Desk Reservations',
'Reserved By'.Email = currentUser.Email && 
If(
    VarFilterPrevious,
'Check Out From' < Now(),
'Check Out From' >= Now()
)
),
"CheckOutFromNumber",
Descending
)

 


Thanks,
Stalin - Learn To Illuminate

View solution in original post

2 REPLIES 2
StalinPonnusamy
Community Champion
Community Champion

Hi @kinghnvn 

 

Set OnSelect property of UpComing Tab to

 

 

UpdateContext({VarFilterPrevious: false})

 

 

Set OnSelect property of Previous to

 

 

UpdateContext({VarFilterPrevious: true})

 

 

 

Set Gallery Items property to

 

 

SortByColumns(
Filter(
'Desk Reservations',
'Reserved By'.Email = currentUser.Email && 
If(
    VarFilterPrevious,'Check Out From Number' < Value(Text(Now(),"yyyymmddhhmm")),
'Check Out From Number' >= Value(Text(Now(),"yyyymmddhhmm"))
)
),
"CheckOutFromNumber",
Descending
)

 

 

 

Set Onvisible property of the screen to

 

 

 

UpdateContext({VarFilterPrevious: false})

 

 

 

this shows upcoming appointments as default.


Thanks,
Stalin - Learn To Illuminate

StalinPonnusamy
Community Champion
Community Champion

Hi @kinghnvn 

 

Please use this. I have optimized the items property of the gallery to

 

SortByColumns(
Filter(
'Desk Reservations',
'Reserved By'.Email = currentUser.Email && 
If(
    VarFilterPrevious,
'Check Out From Number' < Value(Text(Now(),"yyyymmddhhmm")),
'Check Out From Number' >= Value(Text(Now(),"yyyymmddhhmm"))
)
),
"CheckOutFromNumber",
Descending
)

 

 

Result

StalinPonnusamy_0-1637901711267.png

Note: If you have a Datetime Sharepoint column then we can use filter directly instead of converting to text like

SortByColumns(
Filter(
'Desk Reservations',
'Reserved By'.Email = currentUser.Email && 
If(
    VarFilterPrevious,
'Check Out From' < Now(),
'Check Out From' >= Now()
)
),
"CheckOutFromNumber",
Descending
)

 


Thanks,
Stalin - Learn To Illuminate

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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