cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
seacoff
Advocate I
Advocate I

Listbox

Hi

 

I am going around in circles a bit but i can't seem to get the hang of the multiple select in a lisbox.

 

I auto created the sharepoint list form

I created custom field with a listbox.

I populate the Listbox from another sharepoint list.

I can multiple select in the editform.

I have ListBox3.SelectedItems.Value in the Update Box, and  i get an error stating that it has to be text, so to workaround this i convert to text.

I can convert to string Concat(ListBox3.SelectedItems.Value;Value & ",") to save the multiple select so i can view it ni teh browse screen and viewscreen

But how then do i edit the record and preselect the values within the listbox when i open it. At the moment it just doesnt show any selected. Is there an easy way to use Default to Pre-Select Multiple selections in a listbox? Obiously i am converting the selections to text  therefore when i apply to default it wont preselect. How do i work around this?

 

Is there a clear and best practice way of handling Listboxes?

 

Thanking you in advance


Seán

3 REPLIES 3
Steelman70
Power Participant
Power Participant

Hi, just to make sure of what you are trying to achieve.

  1. You have a lookup column in an SP list that allows for multiple selections
  2. You want to update that lookup column via a listbox contol in PowerApps

Is that correct?

 

If so I think PowerApss currently does not support multiple selection lookups, and there may even be a PowerApp Idea for this that you can give kudos to. See here for details https://powerapps.microsoft.com/en-us/tutorials/connection-sharepoint-online/#known-issues  It clear states: "For Lookup columns, the Allow multiple values checkbox must be cleared"

 

I personally don't use multiple selections but understand that it is in theory an easy approach.  The more robust approach is to have a third list (i.e. in addition to the one with the lookup column and the list being looked up) which links the two.  This third list has two lookup columns: one to the first list and one to the second.  To give the robustness you add an index to allow only one combination of the two lookups, and in SharePoint you can do this with a calculated column.  Please let me know if you need details.

It is just that not all databases allow for multiple selection lookups and this is how it is normally done.

thanks so much for replying

 

1. I am using a custom field , maybe this is my first issue that i am using a textbox. we have a very basic sharepoint list hence I was happy enough to convert the PowerApps listbox slection to text. It is only a text box not lookups

We use excel power query to make sense of the data which pulls the raw data from SP.

  

2. I want to be able to edit the form with the selected list of items PRE-selected for me minutes or days later using the PowerApps form. If i selected 10 out of 20 items from a listbox you can understand that i need to populate the selections upon opening otherwise if i saved i wouldn't have the 10 items

 

Default will not allow a list / table to be entered or is there another way to remotely select items ? SelectedItems.Value and Selected.Value seem to be read only

 

 

I hope i am clear enough that i just want to be able to select a number of items in a listbox and save it then open it again and edit it  with it being able to preselect the earlier saved selected items.

 

Cheers

Sean

Thanks, all is now clear.  I am very familiar with Power Query and am a fond user.

 

By far the most robust and easier approach would be to structure your data as I mentioned in my previous post.  I understand this may be a bit of a change but:

 

1) In PowerQuery you will be able to reproduce the same output as you so today

2) In PowerApps you can use a custom gallery instead of a listbox.  The only reason not to use a listbox is that as you mention you cannot pre-selct multiple items (unless anyone else knows how).  You can have a check box element in the gallery to select/desect items etc.

3) You will be able to change the name of any of the listed elements and not have to fiddle with your data to reproduce the change.

4) You will be able to achieve your objectives

5) If in future we are able to use a table or list for default items in a listbox, then you can easily convert back the gallery to a listbox

 

Please let me know if you would like to experiment with this and I will try to giude you.

 

In any case please create a new idea (unless one exists already) to be able to set the Default property of listboxes with tabels/lists

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (37,279)