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

EmS23
Frequent Visitor

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

EmS23
Frequent Visitor

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 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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,708)