Hello Gliders! My component is COLLECTION and in OPTIONS I would like to filter like this:
1)TYPE is EXPENSE
AND
2) UserID is RowID OR UserID is EMPTY
But apparently you can only use AND or OR throughout. Can´t you mix AND and OR?
Hello Gliders! My component is COLLECTION and in OPTIONS I would like to filter like this:
1)TYPE is EXPENSE
AND
2) UserID is RowID OR UserID is EMPTY
But apparently you can only use AND or OR throughout. Can´t you mix AND and OR?
No you can’t mix both unfortunately.
But, as a workaround, you can make multiple if else then else columns with specifics conditions, negation conditions to make it possible to use only AND or only OR. That is what I usually do!
Yes! The if-then-else column solves the issue. Thanks!
Anytime!
Your If-Then-Else would look like this I believe.
If TYPE is not EXPENSE then false.
If UserID is EMPTY then true.
Is UserID is not RowID then false.
Else true.
Hola Martín,
When this case gets complicated due to new conditionals appearing, I prefer to use this short JS code to handle the logic and use the value “true” as a filter parameter in Glide components.
Something like this:
if ((p1 == "EXPENSE") && (p2 == "yourRowID" || p2 == ""))
return true
just play with the conditional AND (&&) / OR (||) by putting your cases in the IF statement to create an easy-to-understand logic
An If-Then-Else column using more than 4-5 combinations (with AND/OR mixtures) can drive anyone crazy
Saludos!
I didn’t think about that. You are right, this is so much more powerful!
Awesome! Muchas gracias!!
Please beware of running JavaScript on bigger tables though. If there’s a “native” solution like If-Then-Else, I would prioritize that.
Ok, so this Filtering data with AND and OR - #3 by MaximeBaker is better native solution then.
Again … all will depend on the size of your table and the amount of columns you have to create to get a simple result when you have many OR/AND as conditionals in an ITE column.
If I have more than 5-6 conditions and a rare mixture of ON/AND, visually is a little complex understand the logic and worse, modify the logic due to a new condition can be a nightmare.
My rule is simple and I think it applies to save a large amount of data when the APP is running:
If my table has 15k rows, why do I need to create other 45k-60k new rows (by 3-4 columns) only to use a native solution?
It doesn’t make sense to me.
Saludos a todos!
From what I gather in performance mode, anything related to time is slow as hell, then JavaScript is next.
I agree that if you have a very complex case, JavaScript might be better for debugging purposes, but in this case it comes out like this for my 1000 rows sample.
The results are identical.
But the time to calculate them is not.
JS took 11ms, ITE took 3ms.
Nice test!
In the end I’m not going to fight for 8ms… I invite you a coffee!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.