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 / Collect with Switch (t...
Power Apps
Unanswered

Collect with Switch (to select SP List) not working

(0) ShareShare
ReportReport
Posted on by

Hi All

I need to add item to one of 20 SP Lists(depending on one value) so I am trying to do 

Collect(
  Switch(OneValue,
     1, If(Value2=1, SPList1,SPList2) ... and so on for 20 times
  ),
 {Col1:data1, Col2:data2}

)

But getting  "The specified Data Source cannot be used with this function"
If I change Switch to SPList1 it works fine so it looks like Collect not happy with using Switch to select data source  

Categories:
I have the same question (0)
  • Verified answer
    LRVinNC Profile Picture
    2,297 on at

    Yes, I am just running into a similar issue where I would like to be able to easily toggle between production and development environments in a similar fashion, but that does not yet appear to be an option.  I believe you will need to actually perform the collect inside the switch to accomplish this.

     

      Switch(OneValue,
         1, Collect(SPList1, {Col1:data1, Col2:data2}),

         2, Collect(SPList2, {Col1:data1, Col2:data2}),

         repeat for all twenty lists

    )

     

    I will have to do the same with my Patch statements, using a Switch to determine whether to patch to Resources or ResourcesDEV. 

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard