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

Combobox & Update

Please can somone tell me what syntax I need to write in the update field of my Datacards to write the choices of a combo box to my SP list? My combobox choices (items) are being pulled from a different SP list to my form, resulting in them not saving their selcted values to the forms SP list on form save.

 

Problem one, Single choice update using a combobox that doesn't allow multiple selection

 

Currently my Combobox update field is set to: MachineTypeDataCardValue.Selected

 

Problem 2, Multiple choices to be updated on a combbobox that allows multiple selection

 

Currently my Combobox update field is set to: OptionsTypeDataCardValue.SelectedItems

 

 

Neither of the above options actually update anything to the sharepoint list

9 REPLIES 9
Super User
Super User

Re: Combobox & Update

Your syntax for both appears correct so there must be something else going on.  Is your Items property on the Data Card Value set up to point to the correct columns in the SP List?

Community Support Team
Community Support Team

Re: Combobox & Update

Hi @Coatsy35 ,

Are these choices columns choices type or look up or person/group type in your sp list?

 

If they are choices type,as @LRVinNC 's post there is no problem with your update's formula expression.

I test as next:

20190422choicedatasource1.PNG

Then Add one Edit Form in PowerApps:

20190422choicetestapp.PNG

DataCardValue2.Items:Choices('20190422ChoiceTest'.Choice)

Choice_DataCard1.Update:DataCardValue2.Selected

 

DataCardValue3.Items:Choices('20190422ChoiceTest'.Choice_M)

Choice_M_DataCard1.Update:DataCardValue3.SelectedItems

 

Then test:

20190422savechoice.gif

 

Result Check:

20190422choiceresultcheck.PNG

 

Hope this could be helpful.

 

Best Regards.

Yumia

Coatsy35
Level: Powered On

Re: Combobox & Update

.

Coatsy35
Level: Powered On

Re: Combobox & Update


@v-yuxima-msft wrote:

Hi @Coatsy35 ,

Are these choices columns choices type or look up or person/group type in your sp list?

 

If they are choices type,as @LRVinNC 's post there is no problem with your update's formula expression.

I test as next:

20190422choicedatasource1.PNG

Then Add one Edit Form in PowerApps:

20190422choicetestapp.PNG

DataCardValue2.Items:Choices('20190422ChoiceTest'.Choice)

Choice_DataCard1.Update:DataCardValue2.Selected

 

DataCardValue3.Items:Choices('20190422ChoiceTest'.Choice_M)

Choice_M_DataCard1.Update:DataCardValue3.SelectedItems

 

Then test:

20190422savechoice.gif

 

Result Check:

20190422choiceresultcheck.PNG

 

Hope this could be helpful.

 

Best Regards.

Yumia


I have just altered my OP to say that my combo boxes are taking their choices from a different SP list to that which my form saves too. BTW the column in which I wish to save to is a Choice column.

 

My problem is nothing selected in the comboboxes gets saved to my form SP list, if I set the comboxes choices manually in the form SP list, it works fine. However I need to have y chocies pulling from an external SP list., in this situation they don't save.

Coatsy35
Level: Powered On

Re: Combobox & Update


@LRVinNC wrote:

Your syntax for both appears correct so there must be something else going on.  Is your Items property on the Data Card Value set up to point to the correct columns in the SP List?


There is no items property on the datacard, only on the datacardvalue box which can't be set to my forms SP list, as it is set to another list to load my choices in. The datafield of the card is set to the correct column in my forms SP list.

 

My items property is set to pull my choices in from another SP list i.e SPList2 in this case. So how do I save those items to my form SP list (which is different to the one my choices are on) on form save, thats my question.

Super User
Super User

Re: Combobox & Update

You will need to use Patch to update the 2nd list.  Here's an example of a patch statement where I am patching 3 fields including a lookup column.  You patch a choice field the same way you patch a lookup column.

Patch(
    Audit,
    Defaults(Audit),
    {
        Title: "Department",
        UpdateDate: Now(),
        DepartmentName: {
            Id: LookUp(
                Department,
                Dept in Title,
                ID
            ),
            Value: Dept,
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}
    }
);

You might want to reference this post as well:  https://powerusers.microsoft.com/t5/General-Discussion/How-to-Save-Choice-field-value-using-UpdateIf...

Coatsy35
Level: Powered On

Re: Combobox & Update


@LRVinNC wrote:

You will need to use Patch to update the 2nd list.  Here's an example of a patch statement where I am patching 3 fields including a lookup column.  You patch a choice field the same way you patch a lookup column.

Patch(
    Audit,
    Defaults(Audit),
    {
        Title: "Department",
        UpdateDate: Now(),
        DepartmentName: {
            Id: LookUp(
                Department,
                Dept in Title,
                ID
            ),
            Value: Dept,
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}
    }
);

You might want to reference this post as well:  https://powerusers.microsoft.com/t5/General-Discussion/How-to-Save-Choice-field-value-using-UpdateIf...


I literally have no idea how to do that, I'm pretty new to all this. I will try and learn however. If I use patch to save the choices to my first list i.e. the form list (not 2nd as you mentioned which is where my choices are held), will it effect anythign when I put the form into edit mode to alter things if needed down the road?

Super User
Super User

Re: Combobox & Update

No problem.  Let me make sure I understand a couple things.

List 1 is your primary list that you want to be able to update.

List 2 contains the values you want to use as choices for one of your column in List 1.  

 

A edit form can only update one list - in your case, it appears you need to be able to update list 1.  What I do is to define the columns in List 1 that I want to get their values from another list (List 2) as Lookup columns in my sharepoint list.  This allows the system to handle retrieving the list of valid values for me without my having to do a lot of extra work.  Then, I simply work on List 1 and only list 1, and the system knows via the definition of the column as a lookup column, that it needs to get the valid choices from list 2.  

Here's an example.

choice.jpg

On the form, I have a dropdown for ConsultingObject.  I don't to worry about how to get the values for the list.  Defining the field as a lookup column takes care of that for me.  I actually have 4 lookup columns defined in this list, all doing this work for me.

CO.jpg

 

 

Coatsy35
Level: Powered On

Re: Combobox & Update

Thank you for that. I will dig into it over the coming days. I didn't even know lookup columns existed and functioned like that. I can see how it works. Thank you for taking the time to tell me. I'll be back with more questions I'm sure!

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,575)