web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dataverse Table - Gall...
Power Apps
Answered

Dataverse Table - Gallery items Property - Switch and &&& Function

(0) ShareShare
ReportReport
Posted on by

Hi Everyone 

 

I have a gallery in my PowerApps (Dataverse Table as my DataSource)

 

it is showing an error function where the switch part of the formula might not work on larger sets   

and delegation warning for this and sign &&

 

 

SortByColumns(

    Filter(

        'Databases',

        (varUserEmail in Risk_requestor || varUserEmail in 'Risk Manager' || varUserEmail in Primary_risk_owner || User().Email = "Snap.com" || User().Email = "noz.com") && Switch(

            varSatgeIndex,

            1,

            Stage_of_risk = "Identification",

            2,

            Stage_of_risk = "Assessment",

            3,

            Stage_of_risk = "Response",

            4,

            Stage_of_risk = "Monitor",

            5,

            Stage_of_risk = "Closed",

            true

        ) && (!Checkbox1.Value || Primary_risk_owner = varUserEmail) && (!Checkbox1_1.Value || varUserEmail in Risk_requestor) && (Len(TextInput2.Text) = 0 || StartsWith(

            'Risk_Title/Summary',

            TextInput2.Text

        ) || StartsWith(

            Risk_requestor,

            TextInput2.Text

        ))

    ),

    "createdon",

    SortOrder.Descending

)
 
Could anyone please help me to fix this issue 
Categories:
I have the same question (0)
  • Verified answer
    anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @Danny_Dicaprio ,

    Instead of using the Switch function, try filtering based on the Stage_of_risk column directly. This should be delegable to Dataverse:

     

    Filter(
     'Databases',
     (varUserEmail in Risk_requestor || varUserEmail in 'Risk Manager' || varUserEmail in Primary_risk_owner || User().Email = "Snap.com" || User().Email = "noz.com") &&
     (Stage_of_risk = "Identification" || Stage_of_risk = "Assessment" || Stage_of_risk = "Response" || Stage_of_risk = "Monitor" || Stage_of_risk = "Closed") &&
     (!Checkbox1.Value || Primary_risk_owner = varUserEmail) && (!Checkbox1_1.Value || varUserEmail in Risk_requestor) && 
     (Len(TextInput2.Text) = 0 || StartsWith('Risk_Title/Summary', TextInput2.Text) || StartsWith(Risk_requestor, TextInput2.Text))
    )

     

     

  • Danny_Dicaprio Profile Picture
    on at

     Hi @anandm08  thanks for the reponse 

     

    on start of PowerApps I have set 

     
    Set(

        varSatgeIndex,

        0)
     I have few buttons above my gallery when they Click on I have set 
    Set(varSatgeIndex, 1);
    Based on this only I want to filter the columns in the Gallery like  
     varSatgeIndex,

                1,

                Stage_of_risk = "Identification",
     
     

     

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    you can filter the gallery in PowerApps based on the varSatgeIndex variable set by button clicks, ensuring delegation:

     

    SortByColumns(
     Filter(
     'Databases',
     (varUserEmail in Risk_requestor || varUserEmail in 'Risk Manager' || varUserEmail in Primary_risk_owner || User().Email = "Snap.com" || User().Email = "noz.com") &&
     If(
     varSatgeIndex = 0, // Show all stages if varSatgeIndex is 0
     True, // No additional filtering
     Stage_of_risk = Switch( // Filter by stage if varSatgeIndex > 0
     varSatgeIndex,
     1, Stage_of_risk = "Identification",
     2, Stage_of_risk = "Assessment",
     3, Stage_of_risk = "Response",
     4, Stage_of_risk = "Monitor",
     5, Stage_of_risk = "Closed"
     )
     ) &&
     (!Checkbox1.Value || Primary_risk_owner = varUserEmail) && (!Checkbox1_1.Value || varUserEmail in Risk_requestor) && 
     (Len(TextInput2.Text) = 0 || StartsWith('Risk_Title/Summary', TextInput2.Text) || StartsWith(Risk_requestor, TextInput2.Text))
     ),
     "createdon",
     SortOrder.Descending
    )

     

  • Verified answer
    timl Profile Picture
    36,725 Super User 2026 Season 1 on at

    Hi @Danny_Dicaprio 

    This isn't as pretty as using Switch, but it should be delegable with Dataverse.

    SortByColumns(
    
     Filter(
    
     'Databases',
    
     (varUserEmail in Risk_requestor || varUserEmail in 'Risk Manager' || varUserEmail in Primary_risk_owner || User().Email = "Snap.com" || User().Email = "noz.com") && 
    
    (
     (varSatgeIndex = 1 && Stage_of_risk = "Identification") ||
     (varSatgeIndex = 2 && Stage_of_risk = "Assessment") ||
     (varSatgeIndex = 3 && Stage_of_risk = "Response") ||
     (varSatgeIndex = 4 && Stage_of_risk = "Monitor") ||
     (varSatgeIndex = 5 && Stage_of_risk = "Closed") ||
     (varSatgeIndex in [1,2,3,4,5])=false
    )
     && (!Checkbox1.Value || Primary_risk_owner = varUserEmail) && (!Checkbox1_1.Value || varUserEmail in Risk_requestor) && (Len(TextInput2.Text) = 0 || StartsWith(
    
     'Risk_Title/Summary',
    
     TextInput2.Text
    
     ) || StartsWith(
    
     Risk_requestor,
    
     TextInput2.Text
    
     ))
    
     ),
    
     "createdon",
    
     SortOrder.Descending
    
    )

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard