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 / Cascading for a ShareP...
Power Apps
Answered

Cascading for a SharePoint Lookup field

(0) ShareShare
ReportReport
Posted on by 3,506

I have the following 3 SharePoint lists:-

 

1) Country List

 

2) City List. Contain a Lookup field named Country >> which reference the Country list.

 

3) Location List. Contain a Lookup field named City >> which reference the City list.

 

 

Now i am customizing the Location list SharePoint form using power apps. and since i am not storing the Country inside the Location list >> so  added a Country ComboBox inside the form, as follow:-

 

country.png

 

So my question is how i can cascade the City list based on the country selection? currently the city list has the following inside the Items property:-

 

items1.png

 

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

    @johnjohn123 

    Yes, if these are lookup columns, then change your Country dropdown Items property to:

    AddColumns(Country As _country,
     "_cities", 
     AddColumns(
     Filter(City, Country.Id = _country.ID) As _city,
     "_locations",
     Filter(Location, City.Id = _city.ID)
     )
    )

    This will produce a grouped list of all the items.

     

    For your City dropdown, set the Items property to: yourCountryDropdown.Selected._cities

     

    For your Location dropdown, set the Items property to: yourCityDropdown.Selected._locations

     

     

    I hope this is helpful for you.

  • johnjohn123 Profile Picture
    3,506 on at

    @RandyHayes  sorry but i did not understand your formula, as i never used grouped lists before. And why i need to use grouped list? I mean can not i just add a filter to the City combo-box's items property to only show the cities linked to the selected Country? am i missing something? thanks

  • johnjohn123 Profile Picture
    3,506 on at

    @RandyHayesi tried your approach/formual where i will get the cascade effect for the City list, but when i save the form the City value will always be null. any idea what is causing this?

    Thanks

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

    @johnjohn123 

    Yes, you can add the Filter to the Items like you have if you want your app to make constant datasource trips and performance is not an issue.  

    The formula provided makes one trip to the datasource and gets the information needed for all the dropdowns without them needing to make more trips to the datasource after that.

    You can do either way.

     

    How are you saving the City value?  And what kind of column is City in your datasource that you are storing into?  Is it a lookup as well, or just a text column?

  • johnjohn123 Profile Picture
    3,506 on at

    @RandyHayesi tried your approach/formula where i will get the cascade effect for the City list, but when i save the form the City value will always be null. any idea what is causing this?

  • johnjohn123 Profile Picture
    3,506 on at

    @RandyHayesyes the City field inside the Location list is a lookup to the City list, as mentioned on my original question..

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

    @johnjohn123 

    Then what is the Update property of your datacard that contains that dropdown?

    It will need to result in a record with an Id and a Value.

    Ex.  {Id: yourDropdown.Selected.ID, Value: yourDropdown.Selected.Title}

     

    The use of Title above is dependent on how your lookup column is defined.

  • johnjohn123 Profile Picture
    3,506 on at

    @RandyHayesi did not change the Update property of the City Combo box, and it is as follow:-

     

    d.png

     

    Do i need to change it?

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

    @johnjohn123 

    Your original Items property of the dropdown was based on Choices.  Choices is smart enough to know what kind of column you have and will only return the record type needed.  So what you had would have worked fine.

    At this point, we are basing on the actual list as you wanted more filtering control as you cascaded. 

    So the Update property needs to produce the proper Lookup column record and as mentioned, it would be:

     

     {Id: DataCardValue2.Selected.ID, Value: DataCardValue2.Selected.Title}

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