cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

Method to Remove items from local Collection

I have an app with various medical questions that I want to flag and collect a condition everytime the user selects "Yes".  Here is an example of my code behind a toggle button:  If(ynSmoker.Value,Set(ReviewFlag,true);Collect(ReviewItems,"Smoker"),false)

 

So my question would be, what if that user selects Yes, but then reverts back to No?  I need to Remove that item from the collection.  Would it be as simple as "Remove(ReviewItems,"Smoker")?  I dont think it would be that easy I am guessing

 

Thanks,

 

Brad

11 REPLIES 11
Highlighted

And your guidance did work.  I tested it and looked at the Collection data in the IDE and I used this: If(ynSmoker.Value,Collect(ReviewItems,"Smoker"),Remove(ReviewItems,First( Filter( ReviewItems, Value="Smoker" ) ),All ))

 

I really didnt need a column name as it is set to "Value" automatically and for me right now, that is all good.

 

Thanks again!

Highlighted

Awesome! Nice work.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,923)