cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

I have a problem with the delete function in a generated "workspace" app

The delete function uses a system variable,, ie "BrowseGallery1.Selected", that is set on leaving the gallery for the detail section.
A problem has occurred that occasionally incorrectly deletes the wrong record.
To be specific, if the user wants to delete a recently created record, the system variable is sometimes set to the last old record.
This is probably because I was to generous with navigation, which may be corrected by restricting it, but I would prefer a more durable solution.
So, I'd like to know if there's a way to set "BrowseGallery1.Selected" to the recently created record since my attempt at fixing the problem by replacing it with my own code generates an error:

 

RemoveIf([@Tabell1]; Regnr = regnr_DC1.DataField );; If (IsEmpty(Errors( [@Tabell1]; Filter( Fordon; Regnr = regnr_DC1.DataField) )

Thanks for reading,
Johan Arve


DetailScreen1.IconDelete1 in
Power Apps

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Does regnr contain a unique value for each record ? If so, set a Variable on the OnSelect of BrowseGalllery1

Set(varReg,ThisItem.regnr)

then the Item of your Form should be

LookUp(
   TableName,
   regnr = varReg
)

then your delete code

RemoveIf(
   TableName,
   regnr = varReg
)

 

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

3 REPLIES 3
Anonymous
Not applicable

I have tested inserting the screen name and form name in front of the datacard name, but the error persists. There's a hint suggesting that there's a problem with data types. The data source are Excel and Access files, but both should be strings since a "regnr" had both numbers and letters. 

Hi @Anonymous ,

Does regnr contain a unique value for each record ? If so, set a Variable on the OnSelect of BrowseGalllery1

Set(varReg,ThisItem.regnr)

then the Item of your Form should be

LookUp(
   TableName,
   regnr = varReg
)

then your delete code

RemoveIf(
   TableName,
   regnr = varReg
)

 

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

 

Anonymous
Not applicable

Thank you. You rule.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,709)