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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Delete rows by matchin...
Power Apps
Unanswered

Delete rows by matching info in different columns

(0) ShareShare
ReportReport
Posted on by 102

Hi,

 

I am working on the app, substituting tabular document, and I am working on revision control logic.

RevLine ClassItem CodeDescriptionSizeRevStatusPrevStatusRowCountOldRowCount
01A1111aaaaaa5Published 1 
01A1112aaaaab4Published 2 
01A1113aaaaac8Published 3 

 

So during editing stage, I am trying to keep both records: published and edited (need to reviewed before publishing).

At each step I am saving Previous status and tracking RowCount of original item to have mapping.

RevLine ClassItem CodeDescriptionSizeRevStatusPrevStatusRowCountOldRowCount
01A1111aaaaaa5Published 1 
01A1112aaaaab4Published 2 
01A1113aaaaac8Published 3 
01A1112aaaaab3EditedPublished42
01A1113aaaaac6EditedPublished53

 

Once Lead has reviewed edition, Rev Status.

RevLine ClassItem CodeDescriptionSizeRevStatusPrevStatusRowCountOldRowCount
01A1111aaaaaa5Published 1 
01A1112aaaaab4Published 2 
01A1113aaaaac8Published 3 
01A1112aaaaab3ApprovedEdited42
01A1113aaaaac6ApprovedEdited53

 

I have completed these steps, using patch function on selected row from the Gallery. 

However, I am struggling with last operation, since document is big we need to make in bulk.

We need to do two thing at the same time:

1. Convert Approved/Edited items to Published status - no problem there.

2. Convert Published obsolete items to Deleted status, using information in RowCount and OldRowCount columns. - I am struggling with this.

Can someone help me with this?

 

RevLine ClassItem CodeDescriptionSizeRevStatusPrevStatusRowCountOldRowCount
01A1111aaaaaa5Published 1 
02A1112aaaaab4Deleted 2 
02A1113aaaaac8Deleted 3 
02A1112aaaaab3Published 42
02A1113aaaaac6Published 53

 

If that make difference, at the moment, my data types for columns are following.

RevLine ClassItem CodeDescriptionSizeRevStatusPrevStatusRowCountOldRowCount
TextTextTextTextNumTextTextNumNum

 

Thanks

Dulat

Categories:
I have the same question (0)
  • SebS Profile Picture
    4,584 Moderator on at

    @Dulat 

     

     

    Could you try to use RemoveIf() ?

     

    RemoveIf(
     YourDataSource, 
     RevStatus = "Published" && RowCount <= OldRowCount
    )

     

    I'm not sure if I got it right, but have a look.

  • Dulat Profile Picture
    102 on at

    I don't want to remove it from the data source. I want to just change status to Deleted, so users (not admins) do not see it, but it is in the data source for the future information for admins.

  • SebS Profile Picture
    4,584 Moderator on at

    @Dulat 

     

    In that case you can try

    UpdateIf(
     YourDataSource, 
     RevStatus = "Published" && RowCount <= OldRowCount,
     {
     RevStatus: "Deleted"
     }
    )

     

     

  • Dulat Profile Picture
    102 on at

    @SebS 

     

    Thanks for help!

    During revision, edited items may be rejected. RevStatus "Rejected" and PrevStatus "Edited".

    Thus, I want to make sure I am "deleting" only items, which have mapped pair with RevStatus "Approved" and PrevStatus "Edited".

    Basically if item has RevStatus =  "Approved" and PrevStatus = "Edited" and OldRowCount=2,

    I will find item with RowCount=2 and mark its RevStatus as "Deleted".

     

    Something like join operation in SQL or Pandas to filter tables two tables (here same copy of one).

     

    Thanks

     

     

  • Verified answer
    Dulat Profile Picture
    102 on at
    ClearCollect(
    col_publish_delete_edited,
    Filter(
    GalleryPubli**bleep**ems.AllItems,
    RevisionStatus = "Endorsed" && PrevStatus = "Edited" && OldRowCount <> 0
    )
    );
    ForAll(
    RenameColumns(
    col_publish_delete_edited,
    "OldRowCount",
    "OldRowCount1"
    ),
    If(
    !IsBlankOrError(
    Patch(
    datasource,
    LookUp(
    datasource,
    RowCount = OldRowCount1
    ),
    {
    REV: RevisionInput.Text,
    Comments: CommentPublish.Text,
    RevisionStatus: "Deleted",
    PrevStatus: "",
    PublishedBy: User().FullName,
    Published: Now()
    }
    )
    ),
    Patch(
    col_main_table,
    LookUp(
    col_main_table,
    RowCount = OldRowCount1
    ),
    {
    REV: RevisionInput.Text,
    Comments: CommentPublish.Text,
    RevisionStatus: "Deleted",
    PrevStatus: "",
    PublishedBy: User().FullName,
    Published: Now()
    }
    ),
    Notify(
    "Data was not written to the source",
    NotificationType.Error
    )
    )
    )

    @SebS

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard