Try OpenEdge Now
skip to main content
BP Server Developer's Guide
Query service : Working with filters : Parameterized condition support for filter
 

Parameterized condition support for filter

BP Server supports parameterized condition for filter. This allows you to set a condition containing 'Named Parameters'. After setting the condition once, you must call the setParameterValues(Map params) method and pass values for all named parameters. This allows you to reuse the filter object. You can create a filter object and set conditions on it. You can then save this filter object in a persistence storage for reuse. From that time on, while using this filter object to fetch data, you only need to set the parameters on it. Even though parameters are passed as a map, internally they are put into a query string in appropriate order.
For example, you can use named parameters in a WorkItem filter as shown below.
QSWorkItemFilter fil = new QSWorkItemFilter("wifil");
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("longds", 20);
params.put("strds", "banana");
fil.setCondition("BLIDS.STRDS = #strds# and BLIDS.LNGDS= #longds#);
fil.setParameterValues(params);