cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ward_1984
Frequent Visitor

Update a LookUp column in sharepoint

Hi,

I have a gallery where i want to update a Lookup column in a sharepoint list with the values out a combobox. See picture below.

Ward_1984_0-1618655128590.png

 

The Sharepointlist i use has a lookup column named Uitvoerder and is populated with another sharepointlist "Users" and can contain multiple values. And the column name in Users is Title.

So in my powerapp application the combo box "Items" is populated with the sharepointlist "Users"  and the "DefaultSelectedItems" is ThisItem.Uitvoerder.

 

If i click on the Icon next the combobox i have the following code:

 

Patch(
    Interventies;
    LookUp(Interventies;'Id (ID)' = ThisRecord.'Id (ID)');
    {
        Uitvoerder: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";Id : cmb_Uitvoerder.SelectedItems.Id ; Value: cmb_Uitvoerder.SelectedItems.Title}
    }
)

 

 

But i get the error like you can see in the screenshot below.

 

Ward_1984_1-1618655795218.png

Translated: The type of this argument Uitvoerder does not match the expected Type table. Type Record found.

 

But i don't understand the error because i use the syntax cmb_Uitvoerders .SelectedItems.Id and .Title which are Tables like you can see in the picture below:

Ward_1984_2-1618656914995.png

 

So do anybody know what i do wrong?

 

Thanks at advance!

Kind regards,

Ward

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ward_1984 ,

Are you trying to Patch multiple selected items to a Lookup column here? This is the syntax you might need (note I am using the field names you supplied here)

Patch(
   Interventies;
   {'Id (ID)':ThisItem.'Id (ID)'};
   {
      Uitvoerder:
      ForAll(
         cmb_Uitvoerder.SelectedItems;
         {
            Id:ID; 
            Value:Title
         }
      )
   }
)

 

Please click Accept as solution 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 Thumbs Up.

View solution in original post

5 REPLIES 5
StalinPonnusamy
Helper III
Helper III

I believe issue is #1. Is still an issue add #2

 

1. use comma instead of ; like id:data,(Comma)Value:Data

2. Add Value( )

 

Patch(
Interventies;
LookUp(Interventies;'Id (ID)' = ThisRecord.'Id (ID)');
{
Uitvoerder: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";Id:Value(cmb_Uitvoerder.SelectedItems.Id),Value:Value(cmb_Uitvoerder.SelectedItems.Title)}
}
)

 

_____________________________________________________________________________________
Click on Accept as Solution if solved the problem. Check out My PowerApps videos too!

hi @StalinPonnusamy 

 

In the country i live i have to use semicolums instead of columns. And the value() syntax convert text to the corresponding number. Why do i have to do that? (Btw: I tried it but don't work)

 

But your first argument got me thinking. I typed the code over from the internet.

 

 

{Uitvoerder: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"; Id : cmb_Uitvoerder.SelectedItems.Id ; Value: cmb_Uitvoerder.SelectedItems.Title}

 



And i saw that they just use .Id for selecting the Predefined Column in a sharepointlist but i always have to use .'Id (ID)', and the first usable column sharepoint generate is always named Title. So does my syntax looks more like:

 

{Uitvoerder: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"; 'Id (ID)': cmb_Uitvoerder.SelectedItems.'Id (ID)' ; Title: cmb_Uitvoerder.SelectedItems.Title}

 

 

Because if i understand it correctly what i'm doing 😅, then i select the column in my Lookup column "Uitvoerder" in my main sharepointlist and say with the "'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"" wich kind of column it is and then i select the columns in my LookUp column so not "Id" an "Value" but "'Id (ID)'" and "Title".



It still not working but if i know i have to go this direction i'm hopefully one step closer.

 

Thanks at advance!

Kind regards,

Ward

Hi @Ward_1984 ,

Are you trying to Patch multiple selected items to a Lookup column here? This is the syntax you might need (note I am using the field names you supplied here)

Patch(
   Interventies;
   {'Id (ID)':ThisItem.'Id (ID)'};
   {
      Uitvoerder:
      ForAll(
         cmb_Uitvoerder.SelectedItems;
         {
            Id:ID; 
            Value:Title
         }
      )
   }
)

 

Please click Accept as solution 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 Thumbs Up.

View solution in original post

StalinPonnusamy
Helper III
Helper III

Please send us the SP columns types if these answers are not helping. Here is the working command with Text, Boolean and Dropdown types.

 

Patch(
'Leave Request',
LookUp(
'Leave Request',
RequestNumber = Value(DataCardValueRequestNumber.Text)
),
{
Title: DataCardValueTitle.Text,
PreApproved: DataCardValuePreApproved.Value,
Level1Approval: ({
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: DataCardValueLevel1Approval.Selected.Value
})
}
);

@WarrenBelz  i am trying to Patch multiple items to the column and it works with your syntax.

 

Thanks for the reply!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (89,484)