cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MN003
Post Patron
Post Patron

Filtering Lookup Field Values

Hello,

 

How can I filter date values within my dropdown field in my PowerApps form? This dropdown field is based on a lookup column within my SharePoint list called (MeetingDates). The lookup column (MeetingDates) and source list column (StartDate) store dates in MM/dd/yyyy format.

 

I want to be able to hide the dates that have passed in the dropdown without deleting them from the source list. How can I achieve this?

 

Ex. 7/4/2022 (Should be hidden)

7/11/2022 (Should be hidden)

7/18/2022 (Would be hidden after today)

4 REPLIES 4
RandyHayes
Super User
Super User

@MN003 

You will need to simply filter the records of the MeetingDates list in your Items property for the control.

If you are currently using Choices, then you will need to realize that this will change the schema of the records in the control.  Meaning that, to your app, the records will no longer be records with an Id and Value column, but will be the full record from the list.

 

However, you can compensate for that in your Items property if you need to.

 

Also, what kind of column is StartDate?  If it is a Date column, then you need not worry about the format of it...a date is a date!  

 

As an Example of the above assuming that StartDate is a date column, your Items property would be:

ForAll(
    Filter(MeetingDates, StartDate>Today()),
    {Id: ID,
     Value: Title
    }
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes

thank you very much for your response. I think I understood what you mean. 

 

I should've been a little more detailed, sorry about that.

StartDate is indeed a Date column. I'm also confident the code you provided would work but I'm unsure if it would with my current form and its DataSource connection.

 

My SharePoint setup is:

 

List 1 (Master list w/the form and lookup/dropdown field I'm trying to filter - (MeetingDates)

List 2 (Source list, MeetingDates is looking up from the (StartDate) column here

 

Would the code still apply or would it need to be adjusted?

 

The code I've attempted before that didn't work was: 

Filter(list 1,MeetingDates<Today())

RandyHayes
Super User
Super User

@MN003 

Tell me more about the setup.

Is it simply the dropdown/combobox that you want to filter based on the MeetingDates?

And, you mention a Form...is this all in a Form, and if so, what is the Source of the Form?

 

Unless there is something odd in any of the above, what I provided you should give you what you need.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

Sure, below is what I got when I attempted to put the code into the items property for the MeetingDates field.

 

MN003_0-1658231125575.png

Yes, I would only like for the drop down to filter the meeting dates. The source of the form is from List 1 and the source of MeetingDates is from List 2.

 

 

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

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (2,377)