When any of the fields is entered(say Email) and submitted, it needs to be navigated to a report which displays the resultant data. I came to know that we can use dynamic parameter passing to report from Visualforce for this scenario. We have created Report for the same with 3 filter fields called Email, Name and Type. But facing some issue on how to frame the filter criteria in the report. In Controller we wrote something like this to fetch the data based on the fields entered by the user:
String query ='Select Id, Emp_Name__c, Emp_Email__c,Type__c from Employee__c where Status__c!=null '; if(enteredEmail!='' && enteredEmail!=null) query+= ' and Emp_Email__c=:enteredEmail '; if(enteredName!='' && enteredName!=null) query+= ' and Emp_Name__c=:enteredName'; if(selectedType!='' && selectedType!=null) query+= ' and Type__c=:selectedType'; List<Employee__c> result = Database.query(query);
To mimic the above conditions in the report, we gave filter criteria as below which is not working:
Status not equal to ""
Email not equal to ""
Email equals ""
Name not equal to ""
Name equals ""
Type not equal to ""
Type equals ""
Filter Logic : ( 1 AND (2 AND 3) AND (4 AND 5) AND (6 AND 7) )
For 3, 5 and 7 above, parameters(pv2, pv4 and pv6) will be passed dynamically from Vf to the report in the URL.
Please let me know if the above filter logic is correct or need any modifications. Thanks.