Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Create new SP list based on combobox choices

(1) ShareShare
ReportReport
Posted on by 133
Hello, 
 
I have to create an app which users can enter new project and choose what product will be affected in.

After chasing products( it can be one or more ) I need to create another list where my products will be as separate rows in table, is that possible ?
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Create new SP list based on combobox choices
    Can you please post your code as Text including where you are using it (your images are too small to read effectively, though they do not seem to be what I posted).
    Also please include the Items and DisplayFields of the Combo Box.
  • Karolina776 Profile Picture
    Karolina776 133 on at
    Create new SP list based on combobox choices
    Hmm it seems something is not work for me:


    On each configuration that funcion doeas not work .... :( 
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Create new SP list based on combobox choices
    The reason I ask specific questions (such as the Items of cmb_productaffected ) is that if affects the data structure you are reading to and writing from. What you need here is the field name in the other list you are getting the Items from and subsequently displaying in the Combo Box - I will mark it as xxxx and you will need to replace it with this name. So the Patch code would be
    Patch(
       Unit_Cost_CR_Roadmap_Updates,
       Defaults(Unit_Cost_CR_Roadmap_Updates),
       {
          Title: text_project.Text,
          Product: 
          ForAll(
             cmb_productaffected.SelectedItems As _Data,
             {Value: _Data.xxxx}
          )
       }
    )
    and this will also affect the DefaultSelectedItems which would be
    ForAll(
       ThisItem.Product As _Data,
       xxxx: _Data.Value
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Karolina776 Profile Picture
    Karolina776 133 on at
    Create new SP list based on combobox choices
     
    See my answer below:
     
    Product is a multi value choice volumne
    cmb_productaffected is a multi-choice Combo Box
    Items of cmb_productaffected is based on another list:

     
     
    I am trying to create three new record (one with each of the selections)
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Create new SP list based on combobox choices
    Please confirm
    • Product is a multi-value choice column
    • cmb_productaffected is a multi-choice Combo Box
    • The Items of cmb_productaffected
    You can do this also, but the code I supplied earlier should work based on what you have posted
    Patch(
       Unit_Cost_CR_Roadmap_Updates,
       Defaults(Unit_Cost_CR_Roadmap_Updates),
       {
          Title: text_project.Text,
          Product: cmb_productaffected.SelectedItems 
       }
    )
    Also, are you trying to create three new records (one with each of the selections) or one record with the three choices saved in the field ?
  • Karolina776 Profile Picture
    Karolina776 133 on at
    Create new SP list based on combobox choices
    @WarrenBelz for some reason it does not work for me:
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Create new SP list based on combobox choices
    Firstly you do not need those "one use" collection and variable, If this what you are trying to do ?
    Patch(
       Unit_Cost_CR_Roadmap_Updates,
       Defaults(Unit_Cost_CR_Roadmap_Updates),
       {
          Title: text_project.Text,
          Product: 
          ForAll(
             cmb_productaffected.SelectedItems As _Data,
             {Value: _Data.Value}
          )
       }
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Karolina776 Profile Picture
    Karolina776 133 on at
    Create new SP list based on combobox choices
    @WarrenBelz Thanks for your support here!

    I have funcion like below and it allows me to achieve three different rows if in my combobox I have three different products:


     
    The second goal is to have three different rows with different names based on products chosen in combobox, now I have three the same rows:

     
    And the SP list view below:
     
    Could you advice me something here ? (It is important that it can be one or more products chosen, not always the same qty)
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Create new SP list based on combobox choices
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Create new SP list based on combobox choices
    Hi @Karolina776​​​​​​​
    You did not state how you were entering the product, but as an example if from a Text field
    If(
       IsBlank(
          LookUp(
             YourNewList,
             YourProductField = YourTextField.Text
          )
       ),
       Patch(
          YourNewList,
          Defaults(YourNewList),
          {YourProductField: YourTextField.Text}
       )
    )
    If it is from a drop-down of some sort, where are you getting the Items from ?

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard