Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom OR logic? #5

Open
vladiibine opened this issue Oct 31, 2015 · 8 comments
Open

Custom OR logic? #5

vladiibine opened this issue Oct 31, 2015 · 8 comments

Comments

@vladiibine
Copy link

It would be awesome if I could do filtering like this:
{
{Username contains 'asdf' AND Lastname contains 'foo'}
OR
{Username startswith 'A' and age < 13}
}

This way a lot more flexible queries could be built

@evoluteur
Copy link
Owner

Yes, adding the ability to have AND or OR would make it way more flexible but it would also need parenthesis. This is a more complex UX pattern.
I'm not sure which direction I want to go with this project (easier but more limited or flexible but more complex). I'll think about it.

@mehkar
Copy link

mehkar commented Dec 29, 2015

My solution (with php):

structured-filter.js

var evoLang={sYada:'Multi'}
//--
evoAPI={sYada:'yada'}
//--
default:
    EvoUI.inputOption(evoAPI.sYada, evoLang.sYada);

custom.php

                         if ($operator=="yada"){ 
                        $gelen_degerler=explode(",",$search_values);
                        $numItems = count($gelen_degerler);

                        $yada_i = 0;
                        $filtre_degerim=" and (";
                        foreach($gelen_degerler as $deger)
                        {
                            $filtre_degerim.=' f'.$i.'.deger like "%' . $deger.'%" ';
                            if(++$yada_i === $numItems)
                                $filtre_degerim.= ') ';
                            else
                                $filtre_degerim.= ' or ';
                        }
                        $additional_where = $filtre_degerim;
                    }
                     $sql="Select * from table where salary=1000 ".$additional_where;

Usage : Select "multi" options and type values with comma.
Like "name1,name2"

@andreas83
Copy link

+1 for operators between conditions.

@jerodfritz
Copy link

+1 for operators

@ruden
Copy link

ruden commented Oct 25, 2016

👍

@aurora
Copy link

aurora commented Jul 23, 2017

👍

@phmulin
Copy link

phmulin commented Sep 5, 2020

👍 + for operators

@jasonhildebrand
Copy link

I think this is a strong library as-is - without the complexity of boolean logic and parenthesis. This keeps the implementation and UX much simpler, while meeting the needs for many use cases.

See https://querybuilder.js.org/ if you need to handle more complex use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants