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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove thisitem from d...
Power Apps
Answered

Remove thisitem from datasource SQL

(0) ShareShare
ReportReport
Posted on by 254

I have a gallery which is showing items in a grouped collection, they are grouped by TimesheetID.  I want to have a button in each row within in the gallery, when pressed the button should remove the current item from the SQL table and then refresh or rebuild the collection using clearcollect.  I had this setup previously and working when I was not grouping the items in the collection, since I changed the collection to be grouped the Remove function no longer seems to work and gives me an error. 

 

I was previously using Remove(MySQLDatasource, ThisItem);

 

Since grouping the collection being used in the gallery, using the above function now gives me "incompatible type: the item you are trying to put into a collection has a type that is not compatible with the collection".  I'm trying to remove from the datasource not add to a collection so I don't know what is going on there.

 

I've also tried the following:-

 

Remove(
MySQLDataSource,
LookUp(
MySQLDataSource,
TimeSheet_ID = ThisItem.Timesheet_Id
)
);

 

Using the above gives me a different error:  This formula uses scope which is not presently supported for evaluation.

 

How can I delete the current gallery item if neither of the above options work, is it because my collection is grouped by the timesheetID?

Categories:
I have the same question (0)
  • Verified answer
    C-Papa Profile Picture
    1,836 on at

    Hi When you use groupby it is basically creating a table within a collection for each row. the issue here is that each record may exists more than once in the collection. you would either need to select the actual item of the group by that you want to delete, say the group was made up for 10 items, removing the 1 item would leave 9. You formula above will do this but you need the allow the user to select you item of the group you want them to delete. You could put a gallery within a gallery to do this or a combo box. 

     

    The other option is to remove all its within the group so 10 items would all be removed. 

     

    to do this you would use the removeif function like below:

     

    remove from datasource

    RemoveIf(MyDataSource,Title = ThisItem.Title)

     

    remove from collection

     

    RemoveIf(MyCollection,Title = ThisItem.Title)

     

    now you will not need to recollect the collection as the value would have been removed from both. 

  • Manc_Gurl Profile Picture
    254 on at

    @C-Papa That seems to work.  Great tip about removing from the collection too so I don't have to recollect. Thanks!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard