cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JohanArve
New Member

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 @JohanArve ,

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
JohanArve
New Member

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 @JohanArve ,

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

 

JohanArve
New Member

Thank you. You rule.

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 (1,969)