web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

Patch Image to CDS

(0) ShareShare
ReportReport
Posted on by 1,104

Hey all,

I had a Patch that suddenly stopped working. Basically it was an image field in CDS that had a Lookup to a main entity, so the main entity had a gallery of related photos that were taken with a camera control.

The images were stored using a button that saves the collection using the formula:

 

ForAll(colPhotos, Patch('Equipment Pictures', Defaults('Equipment Pictures'), {cr387_equipmentphoto: Url, 'Accident Report': galleryMain.Selected, Equipment: dropPickEquipmentEdit.Selected})); Clear(colPhotos); Navigate(scrPhotoView, ScreenTransition.None)

 

Url is the image in the colPhotos collection that the camera control populates. But now it says "The type of this argument 'cr387_equipmentphoto' does not match the expected type 'Record'. Found type 'image'.

So suddenly it is reading the image field in CDS as Record type.

 

Any ideas why this broke?

Categories:
I have the same question (0)
  • PytByt Profile Picture
    943 on at

    Hi @SeanHenderson 

    I dont think the url is working to save image data into the CDS. I was able to do this in my old apps with this formula: 

    ForAll(CameraCollection, Patch('CDSMedia', Defaults('CDSMedia'),{ImageData: Media});

    While in my CameraCollection formula:

    Collect(CameraCollection, {Media:Camera1.Photo});

    Feel free to adjust the formula based on your needs, and see if this helps.

    Regards,

    pytbyt

  • SeanHenderson Profile Picture
    1,104 on at

    I get an error that says Value must be between 0 and 100

  • TaxusLapis Profile Picture
    29 on at

    Ok, 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

  • Avinoam Profile Picture
    53 on at

    Actually it is totally sufficient to only determine the "Value" property, leaving out the "Full" property.

    To summarize this solution I'd put things so:

    • when CREATING a record with image patching - use {Value:[your image.image]} 
    • when UPDATING a record with image patching - use {Value:[your image.image]} 
    • when DELETING a record with image patching - use {Value: Blank() , Full: Blank()} 
  • Gyllentid Profile Picture
    894 on at

    "ForAll([yourCollection],Patch([your entity],Defaults([yourentity]),{[your image field in the entity]:{Full:[your camera.photo value], Value:[your camera.stream value]}}))"

     

    What is yourCollection - is that a table? If so, can I have a gallery.selected instead? Or is that somewhere else?

  • TaxusLapis Profile Picture
    29 on at

    Hey shavora,

    The collection in my case was a normal PowerApps collection, so yes a table of sorts. The gallery is just the "display form" of your collection. You could go for a gallery.selected.[yourImage.image] and patch that to your table as pointed out by @Avinoam . I assume though, that when having a table/collection with the images, it might be a bit of a hassle to individually select the images and patch those, hence the ForAll.

  • TaxusLapis Profile Picture
    29 on at

    Hey Avinoam,

    thanks for the update. When I tried it back then, PowerApps always told me that a value was missing, if I didn't provide values for Value and Full.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard