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 my gallery. if the collection is empty, it is returning all of the data from my data source, but if the collection is not empty, it is not returning any records. Basically i'm tyring to create a dynamic filter option in my app.
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) & ")"
),
", "
)
)
)