web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter a data card bas...
Power Apps
Answered

Filter a data card based off the pervious data card selection

(0) ShareShare
ReportReport
Posted on by 97

Hello, 

 

I am working on an app to collect number around COVID. I have a form that is attached to a SharePoint list. I have the first data card being populated based off who is signed in to enter the numbers. I am looking for a way that when the first data card (Village) is populated to a specific village the second data card will filter to only the options for that village. For more context we have many villages that have many neighbourhoods. I would like to be able to filter the neighbourhood data card to show only the neighbourhoods attached to that village as well as having the option to select non-specific neighbourhood. 

 

I am not even sure if this is possible but everything I have searched is giving me a hard code that if this is selected then this but I need it to have multiple options. 

 

E.g. If the first data card is showing Village 1 then the second data card (Neighbourhood) would show neighbourhood 1, neighbourhood 2, neighbourhood 3 etc. and non-specific neighbourhood. 

 

Hope this makes sense. 

 

TIA

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    Hi @jjasper 

    I assume when you say datacard being populated that you are stating you have a Dropdown control in your datacards.

    If that is the case, then you can simply cascade the dropdowns.

    This will also depend on how you have made these to be dropdowns.  If you did the Change Control Type on the fields (preferred), then you can use the AllowedValues of the DataCard to do this.  If you have completely broken the datacard up and added your own controls, then you will have to work with those control properties.

     

    Can you clarify what you have done up to this point?  Also, perhaps a quick screenshot of the form and any relevant field names and control names would be helpful.

     

     

  • LRVinNC Profile Picture
    2,297 on at

    What you are looking for are dependent (aka cascading) dropdowns.  Here's an example where I use 3 levels of geography, each limiting the list based on the prior selection.  Once the user selects a region, then they get a list of areas in that region.  Once they select an area, they get a list of geos in that area.  This filter is in the Items property of the controls.

     

    Cascading Dropdown.jpg

     

  • jjasper Profile Picture
    97 on at

    jjasper_0-1607011492109.png

    So I haven't really done anything other than add a label and change the property of data card 1 to populate what the label 1 shows.  

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jjasper 

    So if you've just added the form and that is the screenshot of the form as it is by default, then I can tell from it that your Neighborhood is not a text column in your SharePoint list - it is either choices or lookup.

    In which case, you will need to apply the Filter to the DataCardValuex in the Neighborhood DataCard (the name of which is not shown in your picture).

    You can utilize the type of formula that @LRVinNC has suggested.  But, what you base it on is going to depend on your column type for Neighborhood.

    Is it a Lookup or a Choice column?

  • jjasper Profile Picture
    97 on at

    Neighbourhood is a choice column.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jjasper 

    Very good.  

    NOW...the big question - If the column is a Choice column, what logic do you have to filter that choice column?

    In other words, if "Village A" is chosen for the Village, how do you know that, for example,  "Neighborhood 1" and "Neighborhood 3" would be associated with that village?

  • jjasper Profile Picture
    97 on at

    That is also where I am stuck and maybe that is why I can't figure this out. Each Village has a set of neighbourhoods. I am not sure how to assign them a village in SharePoint or it needs to be done on the PowerApps side. I feel this would be super easy if I was doing an edit form but because it is a new form I am lost. Each day they are required to enter a set of numbers for each neighbourhood. I did add in another column for LTC or RH but I don't know how to connect them all together. 

     

    I also don't know if this more complex then it needs to be but I am trying to make it easy for each team to enter their numbers and limit the amount of error. 

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jjasper 

    Actually the connection concept remains regardless of edit form or new form.  Your Dropdown needs to have an appropriate filter to provide the connection.

    So, this is all typically done in another list.  If you have a list - let's call it Neighborhoods, and it might have two columns, the Name of the Neighborhood and the Name of the Village.

    Then, you would set the dropdown to Filter(Neighborhoods, Village=DataCardValue14.Text)

    (and actually in this scenario, I would turn the Village selection into a dropdown rather than a text input)

    Now, your Neighborhood dropdown will display only the results of that filter as based on the Neighborhoods list.

     

    Do you have such a list?

  • jjasper Profile Picture
    97 on at

    Oh that is it? Okay that is way simpler than I thought. I do have have a list of each village and the corresponding neighbourhoods. 

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jjasper 

    Perfect!  Then by all means use that.

    However...the fun is not over yet.  Since this is a Choice column in your list, you will need to make one change (didn't want to get into it before because we were just discussing a way to connect it).

    You will need to set the Items property of the Dropdown to the following in order for your SubmitForm to submit the data properly back to the choice column:

    ForAll(
     Filter(Neighborhoods, Village=DataCardValue14.Text),
     {
     Value: Neighborhood,
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
     }
    )

    Change the "Neighborhood" specified above for the Value to the appropriate column name from your village/neighborhood list.  And then make sure the display field for your dropdown is set to Value (in the properties pane on the right of the designer).

    This will observe the information that SharePoint needs in order to set the Choice column when you submitform.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard