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 / UpdateIf not working w...
Power Apps
Answered

UpdateIf not working with Switch for multiple collections

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Within my app I frequently use a Switch function to point features to different data sources depending on which the user has selected. It is reflected in the Global Variable BusinessUnit. This works well for tables, forms, etc. 

 

 

Switch(
 BusinessUnit,
 "TableA",
 '[dbo].[TableA]',
 "TableB",
 '[dbo].[TableB]',
 )

 

 

 

The following code works as expected:

 

UpdateIf(
 '[dbo].[TableA]',
 UID in DataTable.UID,
 {Date: DataCard1.Update}
)

 

 

 

However, implementing the data source switch, it does nothing:

 

UpdateIf(
 Switch(
 BusinessUnit,
 "TableA",
 '[dbo].[TableA]',
 "TableB",
 '[dbo].[TableB]',
 ),
 UID in DataTable.UID,
 {Date: DataCard1.Update}
)

 

 

Is this a limitation, expected behavior or bug with UpdateIf? The same method works in all other locations I have used it. 

I need to find a workaround that is the least obtrusive, which may be to move the Switch function outside and repeat the UpdateIf multiple times. 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,127 Most Valuable Professional on at

    Hi @Anonymous ,

    Try going a step further back and try this

    Switch(
     BusinessUnit,
     "TableA",
     UpdateIf(
     '[dbo].[TableA]',
     UID in DataTable.UID,
     {Date: DataCard1.Update}
     ),
     "TableB",
     UpdateIf(
     '[dbo].[TableB]',
     UID in DataTable.UID,
     {Date: DataCard1.Update}
     )
    )

    I have had issues in the past with If statements (which is what Switch is) embedded "too far in"

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes, thank you. That is indeed the solution I chose. Unfortunately, with four data sources and more conditions than demonstrated here, it's extremely verbose. It is, however, working. 

  • Verified answer
    WarrenBelz Profile Picture
    156,127 Most Valuable Professional on at

    Thanks @Anonymous ,

    Please Accept as Solution so other people with the same question can find it more readily. This also closes the thread.

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard