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 / Updating collection co...
Power Apps
Unanswered

Updating collection column if collection contains record with similiar column 2

(0) ShareShare
ReportReport
Posted on by 4

Hello, 
I can't google it properly and I've run out of ideas.

I have a table Categories with column Name and TreePath. TreePath is created with ':' and parent record Names.
For example:

 

NameTreePath
Category1   Category1
Category2   Category1:Category2
Category3 Category1:Category3
Category4Category1:Category3:Category4

 

 

I want to update collection's column HasChildren - so I need to check if collection has any record with TreePath like Name, but not equal (well, I might be wrong).

I tried to use:

 

UpdateIf( Categories,
CountRows(Filter(Categories, Find(Name,TreePath))) > 1,
{ HasChildren: true} )

 

 

 

 

But it takes Name and TreePath from the same record.
Do you have any ideas?

Categories:
I have the same question (0)
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Is this something you are looking for?

     

     

    a4.jpga5.jpga6.jpg

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @InfLabAutomate ,

    If it is collection, we don't worry about the delegation warning. Can you try:

    UpdateIf(
     Categories, 
     !IsBlank(
     LookUp(Categories,Name in TreePath && !(Name=TreePath) && !(Right(TreePath,Len(Name))=Name)
     ),
     {HasChildren:true}
    )

    I put three conditions:

    1. Name to be in TreePath

    2. Name not equal with TreePath

    3. Last TreePath not to be Name.

     

  • InfLabAutomate Profile Picture
    4 on at

    Almost, Category2.HasChildren would be false - there's one TreePath with its Name and it's itself.

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    Ok let's change it a little bit:

    UpdateIf(
     Categories, 
     !IsBlank(
     LookUp(Categories,Name in TreePath && !(Name=TreePath) && !(Last(Split(TreePath,":")).Result=Name)
     ),
     {HasChildren:true}
    )

    Try this please !

     

  • InfLabAutomate Profile Picture
    4 on at

    It looked good, but unfortunately it makes all of them false. 

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at
    UpdateIf(
     Categories, 
     !IsEmpty(
     LookUp(Categories,Name in TreePath && !(Name=TreePath) && !(Last(Split(TreePath,":")).Result=Name)
     ),
     {HasChildren:true}
    )

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard