cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Katdragon
Frequent Visitor

Add "Other" option to ComboBox using Lookup as a data source

Hi everyone,

I've tried looking at other posts and videos to solve my problem but I'm just too new to PowerApps to work out the coding for myself so I thought I'd ask here.

 

Basically I'm using PowerApps to create a form so that people can add details about a file to a Sharepoint library (in this case called "Insurance" when they upload a document to it. I was going to use Microsoft Forms but it's too limited so I thought I'd try PowerApps instead.

 

The issue I'm having is with the 'Classification' Lookup column. I'd like to have the option for people to add an 'Other' option and then type in the option to be added to the Lookup. 

 

My first attempt was to use the instructions here: https://www.matthewdevaney.com/create-a-dropdown-with-an-other-option-in-power-apps/ but it's a bit confusing for the end-user as once they type in the text, they can't access the dropdown.

 

The Item identification for the column is:

Choices([@Insurance].Classification0)

 

I then tried looking at the solution here: https://powerusers.microsoft.com/t5/Building-Power-Apps/Add-additional-item-to-Drop-down-List-or-Com... but am confused by the code that's required.

 

If someone could please let me know what to do or direct me to a solution designed for a complete newbie then that would be wonderful.

 

Thanks so much.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Katdragon ,

You can do this in the Items of the Combo Box

Ungroup(
   Table(
      {Value: ["Other"]},
      {Value: Choices(Insurance.Classification0)}
   ),
   "Value"
)

however bear in mind you are going to have some issues writing the data back as you have lost the Id of the Lookup value chosen.
A better idea would be to make a Collection (Screen OnVisible will do)

ClearCollect(
    colDD,
    {
        Value: "Other",
        Id: 0
    },
    Choices(Insurance.Classification0)
)

and then have the Items of the Combo Box as

colDD

An even better idea is to get rid of the Lookup column unless you have a particular reason for using it. I have a blog that may interest you.

 

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.

Visit my blog Practical Power Apps

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @Katdragon ,

You can do this in the Items of the Combo Box

Ungroup(
   Table(
      {Value: ["Other"]},
      {Value: Choices(Insurance.Classification0)}
   ),
   "Value"
)

however bear in mind you are going to have some issues writing the data back as you have lost the Id of the Lookup value chosen.
A better idea would be to make a Collection (Screen OnVisible will do)

ClearCollect(
    colDD,
    {
        Value: "Other",
        Id: 0
    },
    Choices(Insurance.Classification0)
)

and then have the Items of the Combo Box as

colDD

An even better idea is to get rid of the Lookup column unless you have a particular reason for using it. I have a blog that may interest you.

 

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.

Visit my blog Practical Power Apps

Katdragon
Frequent Visitor

Hi @WarrenBelz ,

Thanks for your response - I accidentally hit the "Solved" button before my screen refreshed in PowerApp so I might try and remove it before we continue as I want to get your advice before I hit the button!

 

To go back to the beginning, I inherited two databases of files in older sharepoint libraries that had to be combined and ported over to Sharepoint 365. Because of this, I was limited to the structure of the previous libraries and now have a "DocumentType" lookup list which then feeds into the Classification lookup for some bizarre reason (see screenshot below).

-----

Katdragon_0-1656396714854.png

The only reason I'm using the DocumentType is that I've got several other libraries apart from Insurance (ie, Disputes) that will use the same values.

 

Any thoughts on whether or not I should keep going with the Lookups? I want to make things as easy as possible for people to add information to the database.

Hi @Katdragon ,

I have removed the solution for now - it still however will work for you. If you have inherited this, it is probably a bit dangerous to start playing with it as it may affect other things.

This is a (very) brief comment on what is a large subject - SharePoint is not a relational database and Lookup columns are a complex field type that will make some things more difficult and others simply not achievable, which would be mostly all be easy if the column was Text. Examples - writing to and Filtering by them can be complex at times and you cannot Sort by them in a Delegable manner and referring to them in general is more difficult.

One thing they can do is get a unique list of items without Delegation issues, however you can use this for your drop-down only and write the contents back to a Text column.

 

WarrenBelz
Super User
Super User

Hi @Katdragon ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Visit my blog Practical Power Apps

Katdragon
Frequent Visitor

Hi,

Yes, that solved the problem. Thanks so much! I'll mark it as "Accepted"

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,613)