I am trying to implement multiple filters on visual force page to generate custom reports by using external system data from rest call.I am not going to store anything in salesforce objects.So i have to do search by looping throught data
like
if(searchField1=searchVal1 && searchField2=searchVal2 || searchField3=searchVal3)){
system.debug('***'+criteria matched);
}
but the problem is i have to change the && and || operators according to user selection from drop-down like if user selects OR and And in dropdown it has to chnage as
if(searchField1=searchVal1 || searchField2=searchVal2 && searchField3=searchVal3)){
system.debug('***'+criteria matched);
}
so i was wondering is there any way to achieve this dynamically...
like
if(searchField1=searchVal1 'operator1' searchField2=searchVal2 'operator2' searchField3=searchVal3)){
system.debug('***'+criteria matched);
}
happy to hear any changes in the code...
(a && b) || c
ora && (b || c)
.