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

Filtering Date/Time Dropdown choices from a Lookup Column

Hi All

 

I will do my best to explain where I'm stuck.

 

The user will have to select the date/time in a lookup column. 

 

What I would like to do with PowerApps is limit the options the user can see to only "recent" date/time. Just to limit the need for scrolling all the way down to pick the more recent options. The default PowerApps drop down menu starts from oldest to newest. 

 

I already have it enforcing unique values.

 

I imagine I need to use Filter in some variation?

 

Browsing through some other forums I have these two different formulas I can use,  but I am doing something wrong as neither of these work.

 

 

 

 

ForAll(
Filter(
[@'CCP 3 Direct Observation Verification'],
'CCP3# Created Time' >= DateAdd(Today(),-30,Days)
).CCP3_x0023_),
CCP3_x0023_)
)

 

or

 

Filter(Choices(
([@'CCP 3 Direct Observation Verification'].CCP3_x0023_);
Value( in Filter('CCP 3 Direct Observation Verification', 'CCP3# Created Time' >= Today())

 

Thank you for any help!

 

CCP3 Troubleshoot.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @EmS23 ,

Here is one I did on a Test list and the code is valid

WarrenBelz_0-1656103271866.png

  • LookupDate is a lookup field referencing a date in another list
  • TestDates is a list with some date fields
  • StartDate is a date field in TestDates

If you change the ForAll to Filter, it is also valid, so you might try that as well.

 

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.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @EmS23 ,

Very ambitious approach - but this should be valid code - I cannot test it, so the result will depend on the validity of the data match

ForAll(
   Choices([@'CCP 3 Direct Observation Verification'].CCP3_x0023_);
   Value in Filter(
      'CCP 3 Direct Observation Verification';
      'CCP3# Created Time' >= Today()
   ).'CCP3# Created Time'
)

 

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.

Visit my blog Practical Power Apps

Thank you for taking a look at this! 

 

I gave it a shot but this one returns a few error messages:

ForAll( ##invalid number of arguments; recieved 1, expected 2##
   Choices([@'CCP 3 Direct Observation Verification'].CCP3_x0023_);
   Value in Filter( ##invalid number of arguments; recieved 1, expected 2 or more##
      'CCP 3 Direct Observation Verification'; 
      'CCP3# Created Time' >= Today()
   ).'CCP3# Created Time' ##Name isn't valid, 'CCP3# Created Time' is unrecognized##
)

 

Hi @EmS23 ,

Here is one I did on a Test list and the code is valid

WarrenBelz_0-1656103271866.png

  • LookupDate is a lookup field referencing a date in another list
  • TestDates is a list with some date fields
  • StartDate is a date field in TestDates

If you change the ForAll to Filter, it is also valid, so you might try that as well.

 

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.

Visit my blog Practical Power Apps

Hi Warren,

 

It looks like we're getting closer. The formula works, but when I go to use the form the dropdown box allows me to interact with it but my options don't appear. I will keep working on this and let you know when I fix the setting. Thank you again for explaining the formula so clearly! I appreciate your help.

 

pic1.PNG

pic2.PNG

 

pic3.PNG

  

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 (4,544)