cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
doingthings
Frequent Visitor

Sharepoint Filter Delegation with Switch statement

We are filtering a Sharepoint List and delegation doesn't appear to be working in a specific scenario.

The difference is the addition of a switch statement to choose a connection to use.

 

Any ideas how to help resolve this, either fix the formula or another approach to solve for this use case?

 

 

This works and delegation is ok

 

 

OnStart
Set(MainConnectionNumber, RandBetween(0, 2))

Gallery.Items
Filter(
    Sort(
        'Sp List',
        CustomerName
    ),
    StartsWith(CustomerName, txt_FilterText.Text)
)

 

 

 

This works but no delegation

 

 

OnStart
Set(MainConnectionNumber, RandBetween(0, 2))

Gallery.Items
Filter(
    Sort(
        Switch(ConnectionNumber, 
            0, 'Sp List',
            1, 'Sp List_1', 
            2, 'Sp List_2' 
        ), 
        CustomerName
    ),
    StartsWith(CustomerName, txt_FilterText.Text)
)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BCBuizer
Super User
Super User

Hi @doingthings,

 

By reordering the nesting you can remove the switch from the filter:

 

 

OnStart
Set(MainConnectionNumber, RandBetween(0, 2))

Gallery.Items
Sort(
    Switch(ConnectionNumber, 
        0, Filter('Sp List', StartsWith(CustomerName, txt_FilterText.Text)),
        1, Filter('Sp List_1', StartsWith(CustomerName, txt_FilterText.Text)), 
        2, Filter('Sp List_2', StartsWith(CustomerName, txt_FilterText.Text))
    ), 
	CustomerName
)

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

View solution in original post

1 REPLY 1
BCBuizer
Super User
Super User

Hi @doingthings,

 

By reordering the nesting you can remove the switch from the filter:

 

 

OnStart
Set(MainConnectionNumber, RandBetween(0, 2))

Gallery.Items
Sort(
    Switch(ConnectionNumber, 
        0, Filter('Sp List', StartsWith(CustomerName, txt_FilterText.Text)),
        1, Filter('Sp List_1', StartsWith(CustomerName, txt_FilterText.Text)), 
        2, Filter('Sp List_2', StartsWith(CustomerName, txt_FilterText.Text))
    ), 
	CustomerName
)

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,762)