cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mr-dang
Level 10

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.

Microsoft Employee
@8bitclassroom
Super User
Super User

Re: Remove image from CDS

I tested this and it doesn't work for me. The orginal image remains after the Patch.

 

I was quite excited because this would have been an amazing hack if it did work.  Kudos to @mr-dang for the imaginative suggestion anyway.

RichardB
Level: Powered On

Re: Remove image from CDS

Hi @Audrie-MSFT @audrieg

 

Wondered if you could take a look at this little 'challenge' and provide any inside knowledge on how an image or date/time field in CDS can be updated with a Null value, using the Patch and/or the UpdateIf functions.

 

thanks Richard

mr-dang
Level 10

Re: Remove image from CDS

I haven't tried this, but does the Blank() function work for this?

 

https://powerapps.microsoft.com/en-us/tutorials/function-isblank-isempty/
Microsoft Employee
@8bitclassroom
RichardB
Level: Powered On

Re: Remove image from CDS

Good idea.. but didn't work, looks like we have to accept that you cannot delete an image from a record for the time being.

 

For those interested, I implemented a work around, where I created another entity in the CDS which contained the Image field and an ID ( a Lookup field to the 'master' entity) and then removed the entire record. The other benefit of having a separate entity for images is you can then store multiple images, for the same master record.

 

Thanks to everyone for their contributions

 

cheers Richarrd

 

 

mr-dang
Level 10

Re: Remove image from CDS

A few other work arounds I thought of:

  • Add a field that takes true/false values. Keep it true by default. If the image has been removed, update the record to make it false. When programming the image, make its visibility or Image property only show up if the boolean value is true.
  • Patch a default image for any records--like the silhouette of the facebook dude.

 

Microsoft Employee
@8bitclassroom
hpkeong
Level 10

Re: Remove image from CDS

Hi @RichardB@mr-dang@timl@tofsweden

 

Esp. Richard.

 

Sometimes, I have to really sit down (when free) to think of a work around yet LOGIC formula to accomplish something weird.

I got it done and it is pretty simple and straightforward (I used to be a Simple Man!).

 

Inside your Gallery.Items, add a Icon and set it to
- Icon.OnSelect: UpdateContext({TempName: ThisItem.MyName, TempCountry: ThisItem.MyCountry});Remove(ImageTest, ThisItem);Patch(ImageTest, Defaults(ImageTest), {MyName: TempName, MyCountry: TempCountry})

 

Logic Flow

 

Firstly, store the Field, e.g. MyName which you wish to keep, into a Context Variable and so on.

Then, Remove this item.....continue with

PATCH a new item using TempName & TempCountry.

 

I hope you are happy with this solution to suit your needs.

It may not be a good idea and PA will definitely (I rest assure) have a better and more professional solution than I am.

I just do it for the sake of getting things done - yet simple to understand.

 

Look at the sample screenshot with ACTUAL testing into CDS ONLY.

(Not on other DS, like Excel, SPL, etc.....but I HOPE they shall achieve the same results).

 

Cheers........from South China Sea, a tiny country, a happy country.

 

Screenshot (296).pngActual Apps : Save 4 records, click X to remove images of Malaysia & JapanScreenshot (297).pngTrash to remove - this is normal formula to remove a SINGEL RecordScreenshot (298).pngPatch formula for saving SINGE RECORDScreenshot (299).pngSolution Formula to show combination of: UpdateContext + Remove + Patch

hpkeong
mr-dang
Level 10

Re: Remove image from CDS

@hpkeong

Well done! It works as a temporary solution until there's a direct way. The only risk I foresee is if the app or browser closes after the remove, then you've permanently lost data. @Meneghino had asked about null values, so I hope there is more to come on the matter.

 

Also: I tried writing Defaults(datasource).image, but it doesn't work. Then I tried writing with a condition set to fail If(false,Image1.Image) and that did not go through.

Microsoft Employee
@8bitclassroom
Meneghino
Level 10

Re: Remove image from CDS

Hi @mr-dang, indeed null values is still an issue.  I have had feedback from MS that this is coming 'in the next few months'.

This means that I have to use an ugly work-around until then: use -1 instead of null since I should have no negative values in the field.

Many thanks.

JenVitug
Level 8

Re: Remove image from CDS

@RichardB , i used your workaround, created an entity with the image field and a reference to the original master entity and now, it's not a problem anymore when the image needs to be removed 🙂 🙂 Thank you so much

Helpful resources

Announcements
thirdimage

Power Platform 24

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,093)