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

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Formulas

(0) ShareShare
ReportReport
Posted on by
Hi All. 
for context,

    Data source name: 'TEST_DATA_IN_DATAVERSEs'

    Collection name: 'FilterCollection'
        Collection Example: 
CustomIndex Field Operator Value
1 CLIENT Equals TST
2 SOURCE Equals Telephone
3 VERSION_NUM Equals 0
4 OTHER_SUBTYPE Contains Financial
 
I'm trying to use the below formula in the items property of a gallery. if the collection is empty, it works fine, but if the collection is not empty, it is returning no records.
could someone give me a suggestion on how to work with this?. for more context, i'm trying to acheive a dynamic filtering.

If(
    IsEmpty(FilterCollection),
    TEST_DATA_IN_DATAVERSEs,
Filter(
    TEST_DATA_IN_DATAVERSEs,
    Concat(
        FilterCollection,
        Switch(
            ThisRecord.Operator,
            "Equals", ThisRecord.Field & " = " & Char(34) & ThisRecord.Value & Char(34),
            "Does not equal", ThisRecord.Field & " <> " & Char(34) & ThisRecord.Value & Char(34),
            "Contains", Char(34) & ThisRecord.Value & Char(34) & " in " & ThisRecord.Field,
            "Does not contain", "!(" & Char(34) & ThisRecord.Value & Char(34) & " in " & ThisRecord.Field & ")",
            "Is Greater than", ThisRecord.Field & " > " & ThisRecord.Value,
            "Greater than or equal to", ThisRecord.Field & " >= " & Char(34) & ThisRecord.Value & Char(34),
            "Is Less than", ThisRecord.Field & " < " & Char(34) & ThisRecord.Value & Char(34),
            "Less than or equal to", ThisRecord.Field & " <= " & Char(34) & ThisRecord.Value & Char(34),
            "StartsWith", "StartsWith(" & ThisRecord.Field & ", " & Char(34) & ThisRecord.Value & Char(34) & ")",
            "EndsWith", "EndsWith(" & ThisRecord.Field & ", " & Char(34) & ThisRecord.Value & Char(34) & ")"
        ),
        ", "
    )
)
)
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    151,903 Most Valuable Professional on at
    Formulas
    This is probably not the answer you want, but you cannot dynamically refer to operators or field names with a string - for example the string " = " is just that, it is not the operator = , and the string "CLIENT" is not the field name CLIENT - they both need to be hard-coded (for reasons including that Power Apps can validate it is a valid formula).
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

  • WarrenBelz Profile Picture
    151,903 Most Valuable Professional on at
    Formulas
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 624 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 384 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 246

Last 30 days Overall leaderboard