cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RomanKorchak
Level: Powered On

Collect with Switch (to select SP List) not working

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  

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Collect with Switch (to select SP List) not working

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. 

View solution in original post

1 REPLY 1
Super User
Super User

Re: Collect with Switch (to select SP List) not working

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. 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,140)