cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alanisp22
Helper II
Helper II

Patch All Gallery Items to SharePoint List with Vlookup Columns

Hi,

 

I have attempted to find a solution for this but have been unsuccessful. Hoping someone here can help me out. 🙂 I have a SharePoint form with a Gallery inserted. The Gallery displays all items from a collection titled "DetailedServices", that are added individually by selecting a service-type from a "Service" dropdown menu (pulled data from a SharePoint Vlookup column) and then clicking on a 'Add Service" button at the top of my form. I used the 'Collect' function on the 'OnSelect' field for my 'Add Service' button to submit the service-type selected value to the "DetailedServices" collection as a text. Now my issue is that I cant get the service-types listed in my gallery to patch to a Vlookup column (ServiceName) in my SharePoint list. The Vlookup column (ServiceName) I need the service-types patched to pull data from the same table my "Service" dropdown list on my form.  Is it because I had my service-types added to my collection as a text and not as a value? What's the appropriate function to use in this type of case? 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Alanisp22 ,

 

OK, I got it and the vlookup field you mentioned is the LookUp type column in SharePoint list, right?

The LookUp field data structure is a Record with ID and Value of the related item. You can use Choices('SP list'.LookUpColumn) to get all realted item and use LookUp() function to retrieve the specific one, as follows.

LookUp(Choices(Servicetracker.ServiceName),Value="Surgery") 

 

If you want to Patch All Gallery Items to SharePoint List, please try this:

ForAll(GalleryName.AllItems, Patch(Servicetracker,Defaults(Servicetracker), {'ServiceName':LookUp(Choices(Servicetracker.ServiceName),Value=ServiceTextInput.Text),
Units: ...,
Price: ...
}))

 

Hope this helps.

Sik

View solution in original post

4 REPLIES 4
v-siky-msft
Community Support
Community Support

Hi @Alanisp22 ,

 

Could you please share some snapshots of your app to make the problem easier to understand?

Do you mean you want to Patch a LookUp field value to SharePoint list, right? Where is the Patch() function applied?

Let's say, you applied the Patch() function to Gallery.OnSelect event, and want to save the current items service-types to LookUp column. Then the code should resemble this:

Gallery.OnSelect: 

Patch('SP list', Defaults('SP list'), {LookUpColumn: LookUp(Choices('SP list'.LookUpColumn), Value=ThisItem.'service-types')})

Hope this helps.
Sik

Hi @v-silky-msft, I hope this image is not too small to read. Here is what I am trying to accomplish and what I currently have setup. 

 

Untitled design (18).png

 

One additional note, the fields for my gallery are input fields. 

Hi @Alanisp22 ,

 

OK, I got it and the vlookup field you mentioned is the LookUp type column in SharePoint list, right?

The LookUp field data structure is a Record with ID and Value of the related item. You can use Choices('SP list'.LookUpColumn) to get all realted item and use LookUp() function to retrieve the specific one, as follows.

LookUp(Choices(Servicetracker.ServiceName),Value="Surgery") 

 

If you want to Patch All Gallery Items to SharePoint List, please try this:

ForAll(GalleryName.AllItems, Patch(Servicetracker,Defaults(Servicetracker), {'ServiceName':LookUp(Choices(Servicetracker.ServiceName),Value=ServiceTextInput.Text),
Units: ...,
Price: ...
}))

 

Hope this helps.

Sik

View solution in original post

@v-siky-msft Thank you so much! 🙂

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

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (56,332)