Hi everyone!
I have a filter formula for a SQL datasource in my app that depends on radio values, so for example having a radio with options A, B, C i would need to filter by different criterias like:
IF "radio = 'A'" => filter records where column 1 string equals 'A';
IF "radio = 'B'" => filter records where column 1 string equals 'B'
in the docs🔗 it says that IF doesn't work when delegating queries, i don't entirely understand if it depends if the IF function is using to evaluate a condition IN the table i'm filtering or also applies in a case where the IF evaluates to a value of an element inside the app, so for example,
this wouldn't be delegatable, since i'm evaluating a column in the table:
Filter(
'mySQLTable';
( If(Column1 = 'A' && 'radioInApp'.Selected.Value = 'A' ; Column1 = 'A') )
)
Otherwise, this would be delegatable, because it's evaluating internally with an element inside the app:
Filter(
'mySQLTable';
( If('radioInApp'.Selected.Value = 'A' ; Column1 = 'A') )
)
------------
If it isn't delegatable in both cases, a solution would be to wrap the filter in multiple IFs like:
If('radioInApp'.Selected.Value = 'A' ;
Filter(
'mySQLTable';
Column1 = 'A')
);;
If('radioInApp'.Selected.Value = 'B' ;
Filter(
'mySQLTable';
Column1 = 'B')
)
(...) // Repeats for each radio option
But that isn't the best option, first of all because it is hard to scale and also a problem when having multiple radios that affects the filtering.
So wrapping up the two main questions are:
A) Is the IF non-delegatable when used to evaluate column values or is it non delegatable always regardless on the use (using it inside a Filter())?
B) Is there a clean and mantainable way to filter conditionally on radio values, specially when having multiple-cascade radio options?
Thank you in advance!