Skip to main content

Notifications

Community site session details

Community site session details

Session Id : BmtC/23+HHz460V9XZgKrx
Power Apps - Error Handling
Answered

Create multiple collections and display them in combo-box

Like (0) ShareShare
ReportReport
Posted on 14 Mar 2025 14:10:37 by 10
Hello, I would like to create and display several collections.  My intention is to display only selected values in the cmb_Object_FORM_screen field as required below: 
 
If in the cmb_Region_FORM_screen field:
 
1) the selected value is X then display in the cmb_Object_FORM_screen field in the drop-down list only the values: 1, 2, 3, 4
2) the selected value is Y then display in the cmb_Object_FORM_screen field in the drop-down list only the values: 5, 6, 7
3) the selected value is Z then display in the cmb_Object_FORM_screen field in the drop-down list only the values: 8, 9, 10
 
I have entered the following in the OnStart property of the start page (App): 
 
ClearCollect(
 col_X
 ["1", "2", "3", "4"]
);
ClearCollect(
 col_Y
 ["5", "6", "7"]
);
ClearCollect(
 col_Z
 ["8", "9", "10"]
)
 
In the cmb_Object_FORM_screen field in the Items property, I refer to the collection by:
 
If(
 locSelectedRegion = "X", 
 col_X,
 locSelectedRegion = "Y", 
 col_Y,
 locSelectedRegion = "Z", 
 col_Z,
 []
)
 
 
 
After running RunOnStart, I can see that the X and Y collection has been created and I can refer to it correctly in the rest of the app, but my app does not see the Z collection. Are there any limits on the number of collections that can be created? What could be the error?
  • CU17020806-0 Profile Picture
    10 on 14 Mar 2025 at 14:59:21
    Create multiple collections and display them in combo-box
    Thank you very much, it worked
  • CU17020806-0 Profile Picture
    10 on 14 Mar 2025 at 14:59:21
    Create multiple collections and display them in combo-box
    Thank you very much, it worked
  • Verified answer
    Pstork1 Profile Picture
    65,431 Most Valuable Professional on 14 Mar 2025 at 14:43:33
    Create multiple collections and display them in combo-box
    There is no specific limit on the number of collections.
     
      Change your IF() statement to a Switch().  If() really only allows for two outcomes. Switch is the right choice here.
     
    Switch(
     locSelectedRegion, "X", 
     col_X,
     "Y", 
     col_Y,
    "Z", 
     col_Z,
     []
    )
     

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

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

Thomas Rice – Community Spotlight

We are honored to recognize Thomas Rice as our March 2025 Community…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,508 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,431 Most Valuable Professional

Leaderboard

Featured topics

Loading started
Loading complete