Hey everyone,
So I've got 2 lists here,
SharePoint Picture Library: Auction Item Photos
SharePoint List: Auction Items
In Auction Item Photos, I have a lookup column called Auction Item LookUp which looks up to the Auction Items list and grabs an auction item, essentially making it so that one photo can be re-used by multiple auction items.
I'm trying to make it so that after the Admin creates an Auction Item, they can go in and select all the pictures they want associated with the created item.
Once you click "Done" I want to loop through all the selected photos and add the selected Auction Item to the Auction Item LookUp column.
Currently with my code if I click "Done", it adds the items to the correct photos no problem.
But once I select a different Item to add photos to, its replacing the previous values
ClearCollect(
AddImages,
AuctionItemImageGallery_1.AllItems
);
RemoveIf(
AddImages,
Checkbox3.Value = false
);
ForAll(
AddImages,
Patch(
'Auction Item Photos',
{ID: ThisRecord.ID},
{
'Auction Item LookUp': Table(
{Id: Gallery1.Selected.ID},
{Value: Gallery1.Selected.Title}
)
}
)
)
I believe it may be something to do with the ID I'm using but I've gone too deep, need another set of eyes 🙂
Hopefully makes sense, will clarify if needed.
Hi @Anonymous ,
It is everything to do with the ID and one of the many reasons you need to consider why you actually need to use Lookup columns (this would be very easy with a Text column) - but that is another discussion . . .
The ID (actually Id ) is the ID of the item looked up in the other list and you may not have this in the Gallery. Another issue is that the value you post must match the value of this field in the other list. Assuming that they do match, you would need to do something like this
With(
{
wImages:
Filter(
AuctionItemImageGallery_1.AllItems,
Checkbox3.Value
)
},
ForAll(
wImages As aPatch,
Patch(
'Auction Item Photos',
{ID: wImages.ID},
{
'Auction Item LookUp':
{
Value: aPatch.Title,
Id:
LookUp(
'Action Items',
YourFieldLookedUpName = aPatch.Title
).ID
}
}
)
)
)
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.
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
180 | |
137 | |
96 | |
83 |