web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add Selection from a D...
Power Apps
Answered

Add Selection from a Dropdown to Collection with Dynamic Rows

(2) ShareShare
ReportReport
Posted on by 21
Hello:
I have a dynamic form that allows the user to input as many people or organizations as they need.  Three of the fields on the form are drop-down lists which are populated from SQL tables.  After the user inputs their text data and makes their selections in the dropdowns they click on an Add button which populates the collection and adds a new empty row.  I've set the property of the text field values to ThisItem so the selections on the form show as the user adds rows.  The text fields in the form populate correctly in the collection and the form.
 
The issue I'm running into is the selections from the dropdowns are not displaying once the user moves to the next new record.  I've tried using the ThisItem in the Items property, but then the dropdowns are not populated (they are no items in the dropdown).  I'm trying to figure out how to have the dropdowns display the data from the SQL tables for the user to make their choice and then also populate the form and the collection with the selected value from the dropdowns.
 
I've attached a document with screenshots and details.
 
Thanks in advance for any assistance.
 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
     
    I am going pause you where you said
     
    The issue I'm running into is the selections from the dropdowns are not displaying once the user moves to the next new record. as your picture is good
     
    Ok, so are these combobox multi-select or just single select?
     
    If they are Single Select then 2 things have to happen
    1) set the items to the Total list of possible options 
    2) Set the Default property to the Value in the Collection, which I'd have to see how you are storing them.
     
    or
     
    1) set the items to the total list of possible options
    2) if its multi-select set the DefaultSelectedItems to the value in the collection
     
    or
     
    1) Set the combobox to only load what the user selected (think of it as a View Only Mode)
     
    Can you tell me and show me how you are storing the data in the Collection please, need to see the expressions when you save them as well as I would like you to go look at the Variables section in the UI (click the three ... next to Settings on the menu, then select Variables, then Collections). Then highlight the collection and select View Table
     
    Let's see, after you run and add a single record, stop the run, then look at the Collection see what it shows for that Column.
    And/or also show and tell whats in the Default and or DefaultSelectedItems for the Combobox and Items, depending on the scenario you want (out of the ones I listed above)
     
    THanks
     
  • ML-07031739-0 Profile Picture
    21 on at
    First, thanks very much for responding.
     
    I've attached a doc which shows the collection logic on the Add button, the result in the collection table of adding one record and the properties of each dropdown field.
     
    These are single select dropdowns.  Hopefully I've provided the information you asked for correctly.
  • Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
     
    Looking at this right now thank you for the response details :-)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
     
    Oh sorry, you missed sharing a couple things. But what you did share is good tyty
     
    You also mentioned this is a Dynamic form, but how are you adding multi-items to a form? What control are you using inside the form? A gallery?
    And what is CftPartyType? Another Collection of strings? Or Choices etc? This is important so that we can write the correct Expression for the Default property (I assume that is the issue that its blank or incorrect)
     
    If the default isn't set, then it will not show, or there is no data. Those are the only 2 logical reasons for it to be .. well I am going to say displaying the wrong thing (whether that is nothing or it is the first item).
     
    1. Can you share the Default Property of the DropDown box.
     
    2. You mentioned it's not showing anything. By default, the DropDown should show whatever the first item is from Items (even if the Default property is not set), so either, there is nothing in the items for that row (aka nothing in that CftPartyType, CtfRole or CftRelationshipCode) for that row which would be odd of course.
     
    3. Since you have to choose it every time I have to believe this is a Default property being blank.
     
    My guess is the Default Property isn't set, and is why I asked to see those, as without that, it won't have the data you want, because it will load whatever you want in Items, but it will not "select" the proper thing to show. I am however confused if it's not showing anything, unless you turned on the option for the dropdown not to show anything.
     
  • ML-07031739-0 Profile Picture
    21 on at
     
    Thanks for responding.
     
    The one big thing I don't understand is that the values for the selections that the user made are in the collection table (colSearchNames), as can be seen in the below screenshot.  If I'm referencing that data in the default value of the dropdown field, why doesn't it show? -  It's in there.  Shouldn't it just look to that field in the table and display it?
     
     
     
    "You also mentioned this is a Dynamic form, but how are you adding multi-items to a form? What control are you using inside the form? A gallery?"
    Yes, the fields are all in a gallery.
     
    "what is CftPartyType?"
    The dropdown choices are all being populated by different SQL tables.  For example, CftPartyType is the table name and Description is the text field in the table that I'm using for the values.
    cftpartytype.description
    cftrole.description
    cftrelationshipcode.description
     
    "If the default isn't set, then it will not show, or there is no data. Those are the only 2 logical reasons for it to be .. well I am going to say displaying the wrong thing (whether that is nothing or it is the first item)."
    I get what you're saying about the default value.  In the text fields that are working correctly I have the value being whatever the user selected and that was populated in the collection, so
    ThisItem.firstname
    ThisItem.middlename
    ThisItem.lastname, 
    ThisItem.organization
     
    firstname
    middlename
    lastname
    organization
    are all fields in the collection table.
     
    I tried having default values for the dropdowns as well, but it wasn't working.  I tried ThisItem.cftpartytype but it doesn't like that.  I'm sure it wants me to define the selection from the list of available values in the dropdown, so this is the part I'm struggling with.  I would think it would be something like ThisItem.cftpartytype.selection but that's obviously not the correct format.
     
    I want it to display whatever the user has chosen in the record, just like the text fields are doing.   In the collection I used partytype: drpPartyType.Selected.Description
     
    Can you share the Default Property of the DropDown box.
    As I mentioned above I tied ThisItem.cftpartytype which is the field in the collection table, but it doesn't like that.  Right now there is nothing in the default.  It is blank.
     
     
    By default, the DropDown should show whatever the first item is form Items (even if the Default property is not set),
    Nothing shows, not even the first item.
     
    I am however confused if it's not showing anything, unless you turned on the option for the dropdown not to show anything.
    The DisplayMode property for the dropdowns is set to "Edit"  Could it be functioning unlike you expect because it's pulling from a connected SQL database?
     
     
    I believe the issue is as you suggest, that it needs something for the default because I'm using ThisItem for that in the text fields which are working correctly.  I want it to show whatever the user selected.  The ThisItem function works for the text fields, but I'm guessing the format/naming of the dropdown selections for the ThisItem is what I'm stumbling over.
     
    Below is what I originally tried for the dropdown defaults but it did not work like it did with the text fields.
     
     
     
    Again, thanks for your help.
    -Mark
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
     
    So one thing I was asking for clarify on is, you said Dropdown, but dropdowns do not have Multi-Select support and therefore would not have DefaultSelectedItems so you are referring to a ComboBox, not a dropdown which is different
     
    1. Is it a combobox or a dropdown
    2. Is it set to single select or multi-select (for combo)
     
    it will not work in DefaultSelectedItems, because it expects an Array of records, not a single thing. What you typed in ThisItem.parttype will never work because the property expects an array like
     
    Filter(MyDatasource, Name = ThisItem.PartType) as an example
     
    Or in the Default
    LookUp(MyDataSource, Name = ThisItem.PartyType)
    Default, can also at times correctly work with just ThisItem.PartyType by itself, but not in that DefaultSelectedItems it wont
     
    and I only typed caps cause im being quick.
     
    So the questions above are extremely important and why I have asked before, is it really a dropdown. But you keep saying dropdown which has no such property.
     
     
  • ML-07031739-0 Profile Picture
    21 on at
    I'm using modern controls and I didn't even look at the "Classic" controls. I choose was the one that says preview.  I didn't realize the functionality was any different.  I guess I'll try the classic one and see if I can get it to look like the modern.
  • ML-07031739-0 Profile Picture
    21 on at
     
    I wanted to say I'm sorry I did not realize the modern control drop down was different from the classic.
     
    Also I tested and the modern drop down does not allow for multiple selections.  I tested a modern combo box and it does allow multiple selections.  I don't understand why it says DefaultSelectedItems when you can only choose one item and there's no setting to change that like there is on the modern combo box.  MS is just being MS I guess.
     
    The classic is very ugly, so I don't know how I'm going to implement that.
     
    Thank you for assisting me.
    -Mark

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard