Delete row

Hello everyoone.

 

I want to create an action that will delete one row or (more) if i have two rows or (more) with the same column value and left just one.

Can someone help me to do this please? Thank you.

Solved Solved
0 7 309
1 ACCEPTED SOLUTION

You want to make sure there are no existing rows with the same ID_Equipment and Model. For this we will create a slice that contains only one row with the same unique pair. Let's name this slice uniquePairs

  • Create the uniquePairs slice with this row filter condition:

    [_RowNumber] = MIN(
      SELECT(Table[_RowNumber], AND(
        [ID_Equipment] = [_ThisRow].[ID_Equipment],
        [Model] = [_ThisRow].[model]
      ))
    )

Then you'll create an Action to delete all rows in your table that do not exist in the slice. This action will be configured as below:

  • For a record of this Table: yourTableName 
  • Data: Execute an action on a set of rows 
  • Referenced Table: yourTableName 
  • Referenced Rows: yourTableName[ID] - uniquePairs[ID] 
  • Referenced Action: Delete 

You can display this action as an overlay button that you can click to remove duplicates or make it as a Form Saved action so that it runs whenever the form is saved. 

A better approach, as @TeeSee1 said, is to prevent duplicates from happening in the first place. For this you can put the following expression in the Valid if  field of both your "Model" and "Equipment_ID" columns:

ISBLANK(
  FILTER(
yourTableName, AND(
    [ID_Equipment] = [_ThisRow].[ID_Equipment],
    [Model] = [_ThisRow].[model]
  ))
  - LIST([_ThisRow])
)
 

 

View solution in original post

7 REPLIES 7

  1. Create a slice that will contain only one row with the same value of the column, with this row filter condition:

    [_RowNumber] = MIN(
      SELECT(Table[_RowNumber], [Column] = [_ThisRow].[Column])
    )


  2. Create an action that invokes the system Delete action on this set of referenced rows:

    Table[key] - Slice[key]

@Rafik 

May want to implement some thing to prevent duplicate s in the first place.

@TeeSee1 

Yes,

For example these two rows have the same (model) and the same (id_equipement), so i want to delete one and leave the other Capture.PNG

I tried to do it but I didn't quite understand

You want to make sure there are no existing rows with the same ID_Equipment and Model. For this we will create a slice that contains only one row with the same unique pair. Let's name this slice uniquePairs

  • Create the uniquePairs slice with this row filter condition:

    [_RowNumber] = MIN(
      SELECT(Table[_RowNumber], AND(
        [ID_Equipment] = [_ThisRow].[ID_Equipment],
        [Model] = [_ThisRow].[model]
      ))
    )

Then you'll create an Action to delete all rows in your table that do not exist in the slice. This action will be configured as below:

  • For a record of this Table: yourTableName 
  • Data: Execute an action on a set of rows 
  • Referenced Table: yourTableName 
  • Referenced Rows: yourTableName[ID] - uniquePairs[ID] 
  • Referenced Action: Delete 

You can display this action as an overlay button that you can click to remove duplicates or make it as a Form Saved action so that it runs whenever the form is saved. 

A better approach, as @TeeSee1 said, is to prevent duplicates from happening in the first place. For this you can put the following expression in the Valid if  field of both your "Model" and "Equipment_ID" columns:

ISBLANK(
  FILTER(
yourTableName, AND(
    [ID_Equipment] = [_ThisRow].[ID_Equipment],
    [Model] = [_ThisRow].[model]
  ))
  - LIST([_ThisRow])
)
 

 

Thank you so much @Joseph_Seddik and @TeeSee1 it works well

Hi There

So how do I delete all the older timestamp in a duplicate Standard Tool ID. E,g, How to delete row 115,116 and keep the maxrow timestamp 117 with the latest date 8/15/2023 10:52:32

desmond_lee_0-1692340153800.png

 

Top Labels in this Space