cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Patch image to CDS entity record

I've created a CDS entity "picList" with two columns, one for Part Numbers, populated with unique part numbers, and one for Images. Images column is empty, assigned data type of image. In a canvas powerapp I have a gallery fed from this entity, I have a button, and I have a camera control. What I want to do is select a part number from the gallery then take a picture and save it to the Image column. Below is what I have for the button's OnSelect:

 

Patch(picLists,First(Filter(picLists,PartNums = Gallery2.Selected.PartNums)), {Image: Camera1.Photo});

 

This approach doesn't seem to be working. I'm hoping someone can steer me in the right direction. I'm worried that my concept of what CDS is and what it can do is all wrong. Thanks in advance.

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: Patch image to CDS entity record

Hi @Anonymous 

This is an old post but I have been looking into this issue.  At the present time, it appears that the only reliable way to get an image into an entity is using an edit form and submitting it.  I can't see that anyone has been successful at using a Patch() to get an image into an entity. The other alternative is to add the image as an attachment. 

Highlighted
Frequent Visitor

Re: Patch image to CDS entity record

Hi @Drrickryp , I found a way that works for me, posted it in another thread though, but here it goes again: 

I was facing the same problem, but seem to have found the solution:
As Powerapps states you need a record to patch the CDS entity. My Patch statement now looks like this and it works like a charm:

ForAll(objPixCentral, Patch(objectPictures,Defaults(objectPictures),{img_Object:{Full:picObj,Value:Pic} }))

To have it look more like a template:
ForAll([yourCollection],Patch([your entity],Defaults([yourentity]),{[your image field in the entity]:{Full:[your camera.photo value], Value:[your camera.stream value]}}))

EDIT: 
turns out it is sufficient ot put the same value in both columns within the patch statement, no need to put in the camera.photo and the camre.stream

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (4,777)