Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

Cascading for a SharePoint Lookup field

Like (0) ShareShare
ReportReport
Posted on 8 Feb 2022 18:30:33 by 3,502

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

 

  • Verified answer
    RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 09 Feb 2022 at 00:00:35
    Re: Cascading for a SharePoint Lookup field

    @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}

  • johnjohn123 Profile Picture
    3,502 on 08 Feb 2022 at 23:54:11
    Re: Cascading for a SharePoint Lookup field

    @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?

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 08 Feb 2022 at 23:44:11
    Re: Cascading for a SharePoint Lookup field

    @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,502 on 08 Feb 2022 at 23:40:55
    Re: Cascading for a SharePoint Lookup field

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

  • johnjohn123 Profile Picture
    3,502 on 08 Feb 2022 at 23:38:53
    Re: Cascading for a SharePoint Lookup field

    @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?

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 08 Feb 2022 at 23:25:58
    Re: Cascading for a SharePoint Lookup field

    @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,502 on 08 Feb 2022 at 21:53:16
    Re: Cascading for a SharePoint Lookup field

    @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

  • johnjohn123 Profile Picture
    3,502 on 08 Feb 2022 at 21:40:02
    Re: Cascading for a SharePoint Lookup field

    @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

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 08 Feb 2022 at 19:53:24
    Re: Cascading for a SharePoint Lookup field

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

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 98 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 73

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard
Loading started
Loading started