cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Shafeel_07
Level: Powered On

Combobox multiple selection

Hi powerapps community,

 

i have a combobox which allows multiple selection, when i am trying to patch the values back to my database table, it only patches one value and not the rest? im trying something like this 

ForAll(ComboBox1.SelectedItems,Patch( source,Defaults(source),{Data_Integrity_Test_Case_Id: 45,Data_Integrity_Systems_Id:ComboBox1.Selected.ID}))

 

this code only patches one value instead on multiple. And also it is supposed to create a new row when a new value is patched 

 

Thanks in advance ! 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Combobox multiple selection

Hi @Shafeel_07,

 

Do you want to patch combo box select items to one field?

What is your data source?

And what the column type of Data_Integrity_Sytems_Id and Data_Integrity_Test_Case_Id?

Do you want to patch multiple items to multiple rows or to one field?

I think there is some wrong for your formula, If you want to Patch multiple combobox items,you should use,combobox.selectitems, combobox.seleted.id can only be one item. 

I test with SP list as data source, I think you can try following workaround.

 

Method1:Number type of Data_Integrity_Systems_Id and multiple items to multiple rows.

Data Source:

2019PatchComboboxmutiple(my SP list name)

Data_Integrity_Test_Case_Id (Number type)

Data_Integrity_Systems_Id (Number type)

20190208patchcomboboxmethod1sp1.png

App Test:

ComboBox1.Items:'2019PatchComboboxmutiple'.Data_Integrity_Systems_Id

Button1.OnSelect: ClearCollect(comtest,ComboBox1.SelectedItems);ForAll(comtest,Patch('2019PatchComboboxmutiple',Defaults('2019PatchComboboxmutiple'),{Title:6,Data_Integrity_Test_Case_Id

:45,Data_Integrity_Systems_Id:comtest[@Data_Integrity_Systems_Id]}))

 20190208method1apptest1.jpg

Result Test:

20190207patchcomboboxselectresulttestmethod1.gif

20190208method1resulttestsp1.png

Method2:Single line type and multiple items to one field

Data Source:

2019PatchComboboxmutiple(my SP list name)

Data_Integrity_Test_Case_Id (Number type)

Data_Integrity_Systems_Id (Single line )

 20190208method2sp2.png

App Test:

ComboBox1.Items:'2019PatchComboboxmutiple'.Data_Integrity_Systems_Id

Button1.OnSelect: Patch('2019PatchComboboxmutiple',Defaults('2019PatchComboboxmutiple'),{Title:4,Data_Integrity_Test_Case_Id:45,Data_Integrity_Systems_Id

:Concat(ComboBox1.SelectedItems,Data_Integrity_Systems_Id&",")})

20190208method2apptest2.jpg

On your side :

Patch(‘source’,Defaults('source'),{Data_Integrity_Test_Case_Id:45,Data_Integrity_Systems_Id

:Concat(ComboBox1.SelectedItems,Data_Integrity_Systems_Id&",")})

 

Result Test:

20190207patchcomboboxselectresulttestmethod2.gif

20190208method2resulttestsp2.png

 

 

Hope this can be helpful.

Best Regards.

Yumia

 

 

View solution in original post

6 REPLIES 6
AndySid
Level 8

Re: Combobox multiple selection

 

Hi, do you want to make a new record for each comboBox item? The code below does that or modify for your requirement.

Also you may need to specify the field in the combo, like this:  cboEmployee.SelectedItems.Employee

 

ForAll(
    cboEmployee.SelectedItems.Employee,
     Patch(
        appDailyJobSheets_1,
        Defaults(appDailyJobSheets_1),
        {
            ContractNo: cboDropContractNo_2.Selected.Contract,
            CategoryID: cboCategory_2.Selected.Result,
            Added: Today(),
            ),
            Employee: Employee
        }
    )
)

 

>>If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.<<

Community Support Team
Community Support Team

Re: Combobox multiple selection

Hi @Shafeel_07,

 

Do you want to patch combo box select items to one field?

What is your data source?

And what the column type of Data_Integrity_Sytems_Id and Data_Integrity_Test_Case_Id?

Do you want to patch multiple items to multiple rows or to one field?

I think there is some wrong for your formula, If you want to Patch multiple combobox items,you should use,combobox.selectitems, combobox.seleted.id can only be one item. 

I test with SP list as data source, I think you can try following workaround.

 

Method1:Number type of Data_Integrity_Systems_Id and multiple items to multiple rows.

Data Source:

2019PatchComboboxmutiple(my SP list name)

Data_Integrity_Test_Case_Id (Number type)

Data_Integrity_Systems_Id (Number type)

20190208patchcomboboxmethod1sp1.png

App Test:

ComboBox1.Items:'2019PatchComboboxmutiple'.Data_Integrity_Systems_Id

Button1.OnSelect: ClearCollect(comtest,ComboBox1.SelectedItems);ForAll(comtest,Patch('2019PatchComboboxmutiple',Defaults('2019PatchComboboxmutiple'),{Title:6,Data_Integrity_Test_Case_Id

:45,Data_Integrity_Systems_Id:comtest[@Data_Integrity_Systems_Id]}))

 20190208method1apptest1.jpg

Result Test:

20190207patchcomboboxselectresulttestmethod1.gif

20190208method1resulttestsp1.png

Method2:Single line type and multiple items to one field

Data Source:

2019PatchComboboxmutiple(my SP list name)

Data_Integrity_Test_Case_Id (Number type)

Data_Integrity_Systems_Id (Single line )

 20190208method2sp2.png

App Test:

ComboBox1.Items:'2019PatchComboboxmutiple'.Data_Integrity_Systems_Id

Button1.OnSelect: Patch('2019PatchComboboxmutiple',Defaults('2019PatchComboboxmutiple'),{Title:4,Data_Integrity_Test_Case_Id:45,Data_Integrity_Systems_Id

:Concat(ComboBox1.SelectedItems,Data_Integrity_Systems_Id&",")})

20190208method2apptest2.jpg

On your side :

Patch(‘source’,Defaults('source'),{Data_Integrity_Test_Case_Id:45,Data_Integrity_Systems_Id

:Concat(ComboBox1.SelectedItems,Data_Integrity_Systems_Id&",")})

 

Result Test:

20190207patchcomboboxselectresulttestmethod2.gif

20190208method2resulttestsp2.png

 

 

Hope this can be helpful.

Best Regards.

Yumia

 

 

View solution in original post

JaTd
Level: Powered On

Re: Combobox multiple selection

Hi 

 

And if I want to later edit the information of ShP in powerapps with the format of combobox in line of a line of text?
For example, when selecting an element of a gallery a combobox take the saved data of the selected element from ShP and can edit the multiple selection and then update that information again in ShP in the same record Problema.png

JOEANLI
Level: Powered On

Re: Combobox multiple selection

Hi dear @v-yuxima-msft ,

I have the same problem as the author.

And i create an apps as your solution.

My SharePoint List Name: Shift Turn Registration

Share Point Column Name: TeamMember

 

But apps pop up an alert like this:1.png

 

My Formula like this:

2.png

Although i created an list and apps same with yours, it also have the same alert.

Could u please help?

Thank u sooooooo much!

espenjor
Level: Powered On

Re: Combobox multiple selection

Is it correct that;

- You can store comma seperated data to a MSSQL table database as a string from a multiselection
- You can not retrieve data from an MSSQL table to a multiselection Combox because MSSQL do not have a record infotype / fieldtype?

- The Default property in PowerApp/multiselection combobox expect a record value and will not accept a text string. 

 

It nice to save time by not searching for answers (how to use a multiselection combobox with MSSQL) when there are none.

 

That for any reply!

Akshaypanjwani
Level: Power Up

Re: Combobox multiple selection

I am doing same thing but not working on patch function.
Capture.PNG

here I am saving data and getting error.

Capture2.PNG

 

thanks in advance.

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 163 members 5,470 guests
Please welcome our newest community members: