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

Different data source and Switch/If function

Update 2018-06-04 Fixed

 

==============================================================

 

This error occurred yesterday and did not appear in the past.
When using Switch or If,possible result values reference different data source will show erorr.

 

"All possible result values of the 'Switch' function must reference the same data source."

"All possible result values of the 'If' function must reference the same data source."

 

DataTable.Item

Formula like this.

Filter(Switch(vCode,"A",'A_SharepointSource',"B",'B_SharepointSource',"C",'C_SharepointSource')
,Value = Dropdown.Selected.Value)

 

I need to reference different data source,is there any other way?

 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
sk881209
Level: Powered On

Re: Different data source and Switch/If function

So this means the switch data source with the condition check now works with the items property?

Do you need any further assistance on this topic?

 Now work,like BrandonWeaver said.

"UPDATE: Just got off the phone with Microsoft. They are aware of the issue and are planning on rolling out a fix within the next few days..."

https://powerusers.microsoft.com/t5/General-Discussion/Update-Broke-Switch-amp-If-Functions/m-p/1209...

 

 

No need any further assistance on this topic.

 

 

 

 

 
 

View solution in original post

7 REPLIES 7
kvzonrise
Level: Powered On

Re: Different data source and Switch/If function

Hello,

 

today i found the same problem on a function that was working perfectly before. Doesn't make sense this limitation. 

I need a solution as well

 

Carlos

Mike8
Level 10

Re: Different data source and Switch/If function

Hello,

They need to fix it.
Temporary solution can be to set the collection that you want to use to a variable and display the variable to the Gallery.

Button1.OnSelect = Switch(vCode,"A",UpdateContext({vCollectionForGallery:A}),"B",UpdateContext({vCollectionForGallery:B}))
Gallery1.Items = vCollectionForGallery

but unfortunately you will have other issues that you need to solve.The variable is not the same as having the collection.

kvzonrise
Level: Powered On

Re: Different data source and Switch/If function

Well in my case is different , 

 

I have a switch with multiple views (200) coming from sql server, so i change the view i want to visuallize according to the value that i am switching 

 

ClearCollect(tasks,
Switch(Dropdown3.Selected.Week_number_year,   
"01_2018",Filter('[dbo].[week1]',user_id = users_list_1.Selected.PrimaryID),   
"02_2018",Filter('[dbo].[week2]',user_id = users_list_1.Selected.PrimaryID),   "
03_2018",Filter('[dbo].[week3]',user_id = users_list_1.Selected.PrimaryID),   
"04_2018",Filter('[dbo].[week4]',user_id = users_list_1.Selected.PrimaryID),   
"05_2018",Filter('[dbo].[week5]',user_id = users_list_1.Selected.PrimaryID),
.....)
 

and so on.
i thought about concatenating the name of the collection and call the filter that way directly, but the string cannot be converted to a collection name 😞

ClearCollect(tasks,Filter(Concatenate("'[dbo].[week",Dropdown3.Selected.Week_number,"]'"),user_id = users_list_1.Selected.PrimaryID))

so my concatenation is evaluated as text and there is no way to evaluate that

kvzonrise
Level: Powered On

Re: Different data source and Switch/If function

Well in my case is different , 

 

I have a switch with multiple views (200) coming from sql server, so i change the view i want to visuallize according to the value that i am switching 

 

ClearCollect(tasks,
Switch(Dropdown3.Selected.Week_number_year,   
"01_2018",Filter('[dbo].[week1]',user_id = users_list_1.Selected.PrimaryID),   
"02_2018",Filter('[dbo].[week2]',user_id = users_list_1.Selected.PrimaryID),   
"03_2018",Filter('[dbo].[week3]',user_id = users_list_1.Selected.PrimaryID), "04_2018",Filter('[dbo].[week4]',user_id = users_list_1.Selected.PrimaryID), "05_2018",Filter('[dbo].[week5]',user_id = users_list_1.Selected.PrimaryID), .....)
 

and so on.
i thought about concatenating the name of the collection and call the filter that way directly, but the string cannot be converted to a collection name 😞

ClearCollect(tasks,Filter(Concatenate("'[dbo].[week",Dropdown3.Selected.Week_number,"]'"),user_id = users_list_1.Selected.PrimaryID))

so my concatenation is evaluated as text and there is no way to evaluate that

kvzonrise
Level: Powered On

Re: Different data source and Switch/If function

Well in my case is different , 

 

I have a switch with multiple views (200) coming from sql server, so i change the view i want to visuallize according to the value that i am switching 

 

ClearCollect(tasks,
Switch(Dropdown3.Selected.Week_number_year,   
"01_2018",Filter('[dbo].[week1]',user_id = users_list_1.Selected.PrimaryID),   
"02_2018",Filter('[dbo].[week2]',user_id = users_list_1.Selected.PrimaryID),   "
03_2018",Filter('[dbo].[week3]',user_id = users_list_1.Selected.PrimaryID),   
"04_2018",Filter('[dbo].[week4]',user_id = users_list_1.Selected.PrimaryID),   
"05_2018",Filter('[dbo].[week5]',user_id = users_list_1.Selected.PrimaryID),
.....)
 

and so on.
i thought about concatenating the name of the collection and call the filter that way directly, but the string cannot be converted to a collection name 😞

ClearCollect(tasks,Filter(Concatenate("'[dbo].[week",Dropdown3.Selected.Week_number,"]'"),user_id = users_list_1.Selected.PrimaryID))

so my concatenation is evaluated as text and there is no way to evaluate that

Community Support Team
Community Support Team

Re: Different data source and Switch/If function

Hi Mike8,

 

I saw you wrote:

Update 2018-06-04 Fixed

So this means the switch data source with the condition check now works with the items property?

Do you need any further assistance on this topic?

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sk881209
Level: Powered On

Re: Different data source and Switch/If function

So this means the switch data source with the condition check now works with the items property?

Do you need any further assistance on this topic?

 Now work,like BrandonWeaver said.

"UPDATE: Just got off the phone with Microsoft. They are aware of the issue and are planning on rolling out a fix within the next few days..."

https://powerusers.microsoft.com/t5/General-Discussion/Update-Broke-Switch-amp-If-Functions/m-p/1209...

 

 

No need any further assistance on this topic.

 

 

 

 

 
 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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