Is it possible to add a list of available logical operators, October accepts for its filters?
Closed this issue · 4 comments
Is it possible to add a list of available logical operators October Filters accepts?
We are all trying to second guess what logical operators we can and can not use with the filter lists.
Doc's web page here: https://octobercms.com/docs/backend/lists#list-filters
It would be amazing to have a list of available logical operators for the following things:
-
YAML conditions (without mySQL)
-
YAML conditions (with mySQL)
Basically things like:
- and
- or
- true
- false
- equal
- not equal
etc.
as for mysql things like:
Can we use LIKE
functions or not?
Even a thread with people asking that question (unanswered) see here: https://octobercms.com/forum/post/searching-filtering-a-backend-list-by-like-string
Also can we use mySQL variables etc.
Many questions, but in the end, it would just be nice to have a whitelist of available logical operators and mySQL functions that we can use out-of-the-box with October's filter list widgets in the doc's.
(hope I make sense in this request).
Or if you could point us in the direction to find the information, then we will add it to the October website doc's (no such thing as a free lunch).
I'm guessing all these plus more... (to start the ball rolling)
Logical Operator | Code |
---|---|
Negation of numbers | - |
Logical NOT | ! |
Add, String Concatenation | + |
Subtract | - |
Multiply | * |
Divide | / |
Modulus | % |
Logical AND | AND |
Logical OR | OR |
Equal to | == |
Not equal to | != |
Greater than | > |
Greater than or equal | >= |
Less than | < |
Less than or equal | <= |
Other ones:
eq
ne
lt
gt
=~ like
I don't know if October accepts regex
with filters either...?
Then I don't know which MySQL
functions are whitelisted etc.
Forgot to mention <>
as well in the above list.
Hopefully you can see why we are asking which ones October accepts when writing conditions
yaml filters.
@ayumi-cloud it's just passed to whereRaw(), see https://github.com/octobercms/october/blob/master/modules/backend/widgets/Filter.php#L726-L731.
@LukeTowers Thanks for the link, so basically all this information is missing from the doc's:
date
:filtered
:after
:before
daterange
:afterDate
:after
:beforeDate
:before
number
:filtered
numberrange
:min
:max
text
:value
I mean the doc's should list all these and go into details what each variable does.