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

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Remove image from CDS

(0) ShareShare
ReportReport
Posted on by

Hello, have been successful in Patching a photo to a CDS image field, however I can't work out how to delete it or remove it from the record.

 

Is anyone able to provide a solution to this?

 

Thanks Richard

Categories:
I have the same question (0)
  • tofsweden Profile Picture
    102 on at
    Re: Remove image from CDS

    Create a flow that reads in your cds entity and then delete the chosen attribute (if you choose primaryid then you'll wipe it all)

  • RichardB Profile Picture
    on at
    Re: Remove image from CDS

    Hi tofsweden,

    Thanks for responding, however I don't really undersand your suggestion, are you able to provide any more information?

     

    regards Richard

  • hpkeong Profile Picture
    2,944 on at
    Re: Remove image from CDS

    Hi

     

    If you can save, then you should be able to delete.

    Save:

    Patch(DS, Defaults(DS), {Fields...{)

     

    Delete:

    Remove(DS, ThisItem)...make sure it is placed within the Gallery and for each record.

    (This is to delete single items).

     

    Hope this helps.

  • RichardB Profile Picture
    on at
    Re: Remove image from CDS

    Hi hpkeong,

     

    Thanks for responding.

     

    I understand that the Remove function will remove(delete) the complerte record, which is fine,, but I am interested in removing only the image and leaving the remainder of the record intact.

     

    The documentation states that the UpdateIf function and Patch functions can update specific fields in a record, so I was wondering how they might be used to 'remove/delete' the image contents

     

    thanks Richard

  • hpkeong Profile Picture
    2,944 on at
    Re: Remove image from CDS

    Hi

     

    Alright, you are referring to a particular "Value" a "A record".

     

    Please follow this step as "one of the option":

    - Insert a Button / Trash Icon in the gallery, and it will appear in each record.

    - Please set the formula to:

      UpdateIf(DS, FieldTitle1 = ThisItem.FieldTitle1, {ImageField: ""})

     

    It means:

    Update DS, if FieldTitle1 is equivalent to the This Item's Field Title, Then replace ImageField with Empty records.

     

    NB: Please take note, FieldTitle1 = ThisItem.FieldTitle1 must be from a UNIQUE No. Otherwise, those with similar FieldTitle1 will be deleted at the same time. Please be careful

     

    Hope this helps.

    https://powerapps.microsoft.com/en-us/tutorials/function-update-updateif/

     

    UpdateIf function

    Use the UpdateIf function to modify one or more values in one or more records that match one or more conditions. The condition can be any formula that results in a true or false and can reference columns of the data source by name. The function evaluates the condition for each record and modifies any record for which the result is true.

    To specify a modification, use a change record that contains new property values. If you provide this change record inline with curly braces, property formulas can reference properties of the record that's being modified. You can use this behavior to modify records based on a formula

     

    Sample screenshot is my demo and it works as explained.

     

    Use UpdateIfUse UpdateIf 

  • hpkeong Profile Picture
    2,944 on at
    Re: Remove image from CDS

    Hi

     

    Additionally, if you wish to Delete ALL the IMAGES from ALL the records,

    you can have:

    UpdateIf(DS,  true, {ImageField: "" } )

  • RichardB Profile Picture
    on at
    Re: Remove image from CDS

    Hi there,

     

    Unfortunately, this didn't work and I got an error saying the field is expecting a URL and not an empty string ("")

    I believe your solution will work for text/string based fields, however I think this is the same issue as trying to Patch a Null value to a date field in the CDS.

     

    It would be good to get some comments from the PowerApps tech team as to whether it is currently possible to Patch a null value to any data types in the CDS.

     

    As an experiment I exported the entity to Excel and then substituted the URL string with [Null] and then Imported back and the image was no longer visible in the gallery!

     

    Thanks for you assistance so far

     

    Richard

     

     

  • hpkeong Profile Picture
    2,944 on at
    Re: Remove image from CDS

    Hi @RichardB

     

    Sorry for not being able to help due to my limited knowledge in PowerApps.

    Thanks.

     

  • RichardB Profile Picture
    on at
    Re: Remove image from CDS

    Hi @hpkeong

     

    I have followed many of your previous solutions and they have been very helpful.

     

    It seems there are still some limitations with Patching null values to CDS entities, so hopefully the PA program team and CDS team are working on a solution for this... perhaps we might get a comment from them?

     

    thanks Richard

  • Brian Dang Profile Picture
    3,976 on at
    Re: Remove image from CDS

    I haven't tried this, but maybe if you create an Image box with a blank Image property and try to Patch that, it might clear it.

     

    Let me know if that works.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 655 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 391 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 225

Last 30 days Overall leaderboard