cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HelpWithFlows
Frequent Visitor

RemoveIF

Hi, I'm trying to Create a button which deletes same picture from 2 separate gallery's 

For One it works fine but for second it doesn't do anything.

Code On Select:

RemoveIf(Gallery1,DisplayName = ThisItem.DisplayName);

 

Pictures are saved to two gallery's at same time.

Or should i use another function. 

 

Welp 😄

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @HelpWithFlows 
You are just check gallery 1, so gallery 1 picture only delete. 
RemoveIf(Gallery1,DisplayName = ThisItem.DisplayName);


I have some query about your Apps

1. where to match display name?

2. what are the gallery picture need to delete?

My guess
you are check gallery 1 picture display name matched to delete all gallery matched item

So you coding nee to update

remove if to remove only one data source. so you need to add multiple removeif function to remove what do you need to removed match picture display name.
like below coding
Your matching displayname used to textinputbox called like as TextInput_1.text (selected item). Button press to remove like below

Removeif(gallery1,display=TextInput_1.text );Removeif(gallery2,display=TextInput_1.text );

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 or you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

Hi @HelpWithFlows ,

With names like that, there is no relationship between the images and therefore no way of identifying one from the other, so running a command from one gallery cannot possibly delete the item in the other. Firstly, are they both in the same Library ? If so, you will need to delete each from its own gallery. If not, I suggest you simply name them the same.

 

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.

Visit my blog Practical Power Apps

View solution in original post

10 REPLIES 10
AsanKani
Skilled Sharer
Skilled Sharer

Hi, @HelpWithFlows 
I can't understand, Give more details about your problem.
What is your requirement and what problem now you faced?

I have an app where User should take a 5 separate pictures to 5 separate gallery's, for example first Gallery is Front of Product, Second is Back of Product. and etc. And there is a main Gallery where all photos of all galleries are stocked. 

And it looks like that. 

HelpWithFlows_0-1651490552212.png

And Gallery looks like that, but if i delete it by button. I just delete from Front Gallery and doesn't do anything with main Gallery.

HelpWithFlows_1-1651490624121.png



after deleting there, picture is gone but main gallery still has it.

HelpWithFlows_2-1651490699533.png

Main gallery picture still there.

HelpWithFlows_3-1651490730394.png

 

Hi @HelpWithFlows 
You are just check gallery 1, so gallery 1 picture only delete. 
RemoveIf(Gallery1,DisplayName = ThisItem.DisplayName);


I have some query about your Apps

1. where to match display name?

2. what are the gallery picture need to delete?

My guess
you are check gallery 1 picture display name matched to delete all gallery matched item

So you coding nee to update

remove if to remove only one data source. so you need to add multiple removeif function to remove what do you need to removed match picture display name.
like below coding
Your matching displayname used to textinputbox called like as TextInput_1.text (selected item). Button press to remove like below

Removeif(gallery1,display=TextInput_1.text );Removeif(gallery2,display=TextInput_1.text );

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 or you liked the post and want to show some appreciation, please give it a Thumbs Up.

Thanks, but it seems that 
RemoveIf(Gallery1,DisplayName = ThisItem.DisplayName);
RemoveIf(GalleryMain,DisplayName = ThisItem.DisplayName);

It still doesn't work and main Gallery isn't effected at all.

Collecting pictures code:

UpdateContext({varName: GUID()});
Collect(
Gallery1,
{
DisplayName: varName & ".jpg",
Id: varName & ".jpg",
Value: UploadedImage1.Image
}
);

UpdateContext({varViskas: GUID()});
Collect(
GalleryMain,
{
DisplayName: varViskas & ".jpg",
Id: varViskas & ".jpg",
Value: UploadedImage1.Image
}
);
Navigate(MenuScreen)

 

Maybe this ll help

Maybe you know solution if we talk about code?

 

@WarrenBelz can you support to @HelpWithFlows resolve his problem.. Currently I can't help him. 

@AsanKani ,

Thanks for the tag, but you have asked the right questions here.

@HelpWithFlows  The issue I think is obvious - they are named with different variables in the Collections (varName and varViskas), so I suspect that the Main gallery item has a different name. There is nothing wrong with the RemoveIf code and should delete both if the files are identically named.

Yea you right, but it seems that Display Names are different .
71b6bc66-df35-4333-898d-9963987c67ae.jpg Gallery1
238fdf87-dcef-48c2-82d1-c9a8aec43c76.jpg MainGallery

So what is solutions? Use Same Collection? Or there is another solution?

Hi @HelpWithFlows ,

With names like that, there is no relationship between the images and therefore no way of identifying one from the other, so running a command from one gallery cannot possibly delete the item in the other. Firstly, are they both in the same Library ? If so, you will need to delete each from its own gallery. If not, I suggest you simply name them the same.

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,482)