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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,422)