cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Determine which Sharepoint List to Patch

Hello, 

I have an app using multiple sharepoint lists that hold information for different types of items and their costs. Some of these items can be components of other items. I have a link table for these Parent-Component relationships that holds the primary ID for each and the "CategoryID" for each, which tells me which table that item belongs to. However, when updating prices of components, I have the price updating in the link table, but now I need to update the price of the parent item. 

The problem I am facing is how to use a calculation to determine which table the parent item is located. Right now, I have 5 item tables and don't anticipate adding more so I could use If statements to match the category ID to the right table (If CategoryID = 1, Patch Table1), but I am hoping there is an easier way. 

It might also be worth mentioning that after updating a price, I use GroupBy to create a collection holding all the link information for each unique parent/category and added a column to Sum up all the grouped prices. I just need to be able to easily patch that price into the correct table without too much effort. 

3 REPLIES 3
Super User II
Super User II

You can use a Switch function:

Switch(CategoryID, 1, Patch Table1, 2, Patch Table2)

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

I can see how that can be useful instead of using an If function for everything, but I don't think it solves my issue. If, in the future, I need to add a new category, I need to add to that function. 

If you add a new category and/or a new table, you will have to specify that in your app in one way or another. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (9,757)