cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Al12397
Regular Visitor

Adding an 'NA' option to a comboBox along with the original data

Lets Say I have a datasource with all the countries and their corresponding states/proveniences and the states has been populated in my combobox like the following

Distinct(Filter(tbl_Country, 'Country' = First(cb_Country.SelectedItems).Result),'StateName')
- the filter is there because the user can choose a country which filters a states combobox

Now I have a requirement to add an "NA" option to my comboBox but I cant change the underlying data. Meaning I cant go to datasource and add NA manually to the table. How can I add the 'NA' option along with the rest of the data to my combo box. Secondly Can I have the NA option appear first?

2 ACCEPTED SOLUTIONS

Accepted Solutions
TheRobRush
Super User
Super User

in this video @RandyHayes shows you how to add a "All" option to a dropdown. Same basic idea can help you add any other option you want, and set it's behavior.

 

https://www.youtube.com/watch?v=nlfZD6lsCDc 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

View solution in original post

Anonymous_Hippo
Resolver I
Resolver I

Put this code on Start of the App

ClearCollect(
    CollCountry,
    {Result: "NA"}
);
Collect(
    CollCountry,
       Distinct(Filter(tbl_Country, 'Country' = First(cb_Country.SelectedItems).Result),'StateName')
)

 

And on the Items property of the DropDown put CollCountry

 

I made a test case and this should work 🙂

View solution in original post

3 REPLIES 3
LRVinNC
Super User
Super User

In similar circumstances, I have loaded the values for my combobox to a collection, then patched the collection to add the N/A value, using a leading space so it sorted to the top of the list, and then used that collection instead of the original table.  

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
TheRobRush
Super User
Super User

in this video @RandyHayes shows you how to add a "All" option to a dropdown. Same basic idea can help you add any other option you want, and set it's behavior.

 

https://www.youtube.com/watch?v=nlfZD6lsCDc 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

View solution in original post

Anonymous_Hippo
Resolver I
Resolver I

Put this code on Start of the App

ClearCollect(
    CollCountry,
    {Result: "NA"}
);
Collect(
    CollCountry,
       Distinct(Filter(tbl_Country, 'Country' = First(cb_Country.SelectedItems).Result),'StateName')
)

 

And on the Items property of the DropDown put CollCountry

 

I made a test case and this should work 🙂

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (977)