Retrieve data from database based on multiple parameter

Hi ,   I have a requirement in which I want to retrieve data from database based on the six different parameters entered by users.  Here all the parameters are optional. If any parameters is empty all the records should be return. If parameters are not empty then filteration should be applied and rows should be return accordingly. Please provide the optimal solution for this requirement. 
1 answers

Hi Abrar,


From what I understand from your question, I assume that all parameters are string, then the easiest way is to start with an empty check validation, either one by one or all-in one decision for example

(Parameter1 != empty and Parameter1 != '') and

(Parameter2 != empty and Parameter2 != '') and ...etc

After this decision true goes to the retrieve action by xpath where xpath looks like;

Object/Atribute1 = $Parameter! and

Object/Attribute2 = $Parameter2 ... etc

and false goes to retrieve action of the object without any constrainst.


I hope this works for you,