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 / Reference to current r...
Power Apps
Unanswered

Reference to current record in UpdateIf

(0) ShareShare
ReportReport
Posted on by 6

Hi everyone,

 

In my PowerApp i have a product and a product category. Because this powerapp is intergrated with other software i need a column which contains the productName and CategoryName combined. The category is a parent of the product. 

If i want to change the categoryName, i need to update all records in the combined column which have this category id. It is not a problem to filter these records although i don't know how to reference to the productName within the UpdateIf function. 

 

 

UpdateIf(
	ProductCollection, 
	Value(id_category) = Value(ProductGallery.selected.id), 
	{fullName: Concatenate(thisitem.productName," ",changedCategoryName.Text }
	);

 

 

I get an error in the Concatenate function (invalid arguments). I have also tried to come up with a LookUp function but don't know how to find the current row of the Updateif function. 

 

Any ideas? 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Mattie021 

     

    You might want to consider this as an approach:

     

    UpdateIf(
     ProductCollection, 
     id_category = ProductGallery.selected.id, 
     {
     fullName: Lookup(ProductCollection, id_category = ProductGallery.Selected.ID, productName) & " " & changedCategoryName.Text 
     }
    );

     

    Note: I removed the Value functions on the assumption that both id_category and the selected.ID are numbers.  If so, there is no need for the Value function.  If that assumption is incorrect, then use the Value function around whichever is not a number (i.e. text).

    Also, you can shortcut with just the & character to concatenate.

     

    I hope this is helpful for you.

  • Mattie021 Profile Picture
    6 on at

    @RandyHayes thank you for your reply.

     

    With this LookUp filter i get the same (first) product name for every value it updates. I need to find the specific productName of the row which is updating. My current results now all look the same: 

     

    Product a Category x

    Product a Category x

    ...

     

    While i am looking for:

    Product a Category x

    Product b Category x

    ...

     

    Thank you for the other suggestions 🙂

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Mattie021 

    I misunderstood your original post then.

     

    So, every item in your list should be updated with the original ProductName and the new Category (if it has the old category ID)? 

    If that is the case, is there a unique ID for each record in your collection? 

  • Mattie021 Profile Picture
    6 on at

    @RandyHayes 

     

    Yes that is correct! The products also have an unique ID. 

     

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Mattie021 

    Very good, that helps!

     

    In that case, consider this formula:

    ForAll(
     RenameColumns(
     Filter(
     ProductCollection, 
     id_category = ProductGallery.selected.id
     ), 
     "yourUniqueColumn", "renamedColumn"
     ),
    
     UpdateIf(ProductCollection,
     yourUniqueColumn = renamedColumn,
     {
     fullName: productName & " " & changedCategoryName.Text 
     }
     )
    );

     

    This will go through a Filtered list of items that have a category ID equal to the currently selected one in your Gallery.

    It will then Update the Item (based on the unique column that you have) and set the FullName column to the original productName and the changed category name.

     

    See if that does it for you now.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard