Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Can't save data in Combo Box filled with ClearCollect

Posted on by 1,594

On a SharePoint custom form I have the following formula in the OnStart event of FormScreen1:

 

OnStart=ClearCollect(VAR_A;Filter(Datasource_A;Condition_A))

In the form I have a combo box which Items property I set to:

 

Items=VAR_A

The combo box shows indeed only the values from Datasource_A that meet Condition_A. That works fine.

 

But when I create a new item in the list, after choosing a value for the combo box, when I save the form, the chosen value in the combo box is not saved to the SharePoint list. The field is empty in the list item.

 

Anyone knows how to properly configure a combo box which Items property has been set using a collection so that data is saved to the list item ?

 

I found these 2 articles but I've had no luck trying the suggested solutions:

https://powerusers.microsoft.com/t5/General-Discussion/Combobox-saving-issues/m-p/157222/highlight/true#M53054

https://powerusers.microsoft.com/t5/General-Discussion/Can-not-get-LookUp-selection-to-Save-to-my-List/m-p/156612/highlight/true#M52879

 

I think it has something to do with the fact that the data structure of the Items property filled with a ClearCollect is different then the one filled with Choices and that I probably have to change the Default and/or the DefaultSelectedItems of the combo/datacard but I can't figure out exactly how.

 

Categories:
  • R3dKap Profile Picture
    R3dKap 1,594 on at
    Re: Can't save data in Combo Box filled with ClearCollect

    Hi @Anonymous,

    First of all, do not use the @odata.type thing in your formulas anymore. It's useless now. Setting a value for a lookup is as easy as using the following structure:

    {
     Id: <id>,
     Value: <value>
    }

    About your problem, could you please post a capture on which we can see where the formula is located? On which control and which property?

    Thanks...

  • Re: Can't save data in Combo Box filled with ClearCollect

    Hi 

    I have used the same formula, but it is not saving the data of combobox , please help me

    V__0-1604046280188.png

     

  • Verified answer
    v-xida-msft Profile Picture
    v-xida-msft on at
    Re: Can't save data in Combo Box filled with ClearCollect

    Hi @R3dKap,

     

    Do you want to save a value from the Combo box (connected to another data source) into a Lookup column of your SP list within your custom form?

     

    I have made a test, and the issue is confirmed on my side. I think this issue is related to the modification of data source the Combo box control connected to.

     

    Currently, we could not save a value from the Combo box (connected to another data source) into a Lookup column of a SP list directly. 

     

    As an alternative solution, please take a try with the following workaround:10.JPG

     

    11.JPG

     

    Set the OnStart property of the FormScreen1 to following formula:

     

    ClearCollect(VAR_A,Filter('20180920_case7_1',EmailAddress=User().Email))

    Note: The '20180920_case7_1' represents the Datasource_A that you mentioned.

     

    Set the Items property of the Combo box control within the FavorColor Data card to following:

     

    VAR_A

    Set the Update property of the FavorColor Data card control to following formula:

     

     

    {
     '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id:LookUp(Colors,ColorName=DataCardValue4.Selected.Color,ID),
     Value:DataCardValue4.Selected.Color
    }

    Note: The Colors represents the SP list data source which the FavorColor lookup column reference values from. The FavorColor column is a Lookup column in my SP list the current custom form connected to. The Color represents the column within your Datasource_A, which you use to display within the Combo box control.

     

     

    On your side, you should type the following formula:

    {
     '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id:LookUp(ReferencedSPList,ReferencedColumnName=DataCardValueX.Selected.DisplayColumn,ID),
     Value:DataCardValueX.Selected.DisplayColumn
    }

     

     

    Note: The ReferencedSPList represents the SP list your Lookup column reference values from. The ReferencedColumnName represents the column within the ReferencedSPList your Lookup column reference values from. In addition, please also make sure that the values that you selected from the Combo box control have been existed within the ReferencedSPList list.

     

    The GIF screenshot as below:

    Test1.gif

     

    Please also check and see if the following thread would help in your scenario:

    https://powerusers.microsoft.com/t5/General-Discussion/Lookup-Field-Default-Value-Error/td-p/79481

     

     

    Best regards,

    Kris

  • R3dKap Profile Picture
    R3dKap 1,594 on at
    Re: Can't save data in Combo Box filled with ClearCollect

    Hi @Rebetcha,

     

    My column is a lookup column to another SharePoint list and yes it is located in a datacard...

     

    At the moment, in my combo Update property I have:

     

    DataCardValueX.Selected (X is the number of the datacard)
  • Rebetcha Profile Picture
    Rebetcha 645 on at
    Re: Can't save data in Combo Box filled with ClearCollect

    Hi @R3dKap, couple of questions:

    What type of SharePoint-column are your trying to save the selected combo box value to?

    Is the combobox on a form data card? If yes, what is the formula in the Update property of the datacard?

     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,532

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,050

Leaderboard