The following example shows how you might use a parameter expression in Java code. It creates an RqlStatement and uses it in executing a query to find person repository items where the value of the age property is greater than 23.

RepositoryView view = repository.getView("person");
RqlStatement statement = RqlStatement.parseRqlStatement("age > ?0");

Object params[] = new Object[1];
params[0] = new Integer(23);

RepositoryItem [] items =statement.executeQuery (view, params);

Here is another example that demonstrates a text comparison query:

RqlStatement statement =
   RqlStatement.parseRqlStatement("lastName STARTS WITH ?0");
Object params[] ={new String("m")};
    items = statement.executeQuery (view, params);

Note how in the text comparison queries the comparison value "m" is enclosed in double quotes; otherwise, the RQL parser assumes the comparison term refers to a property name rather than a property value.

 
loading table of contents...