JavaScript API Reference

Ab.view.Restriction object

File: ab-view.js

The Ab.view.Restriction object is used to pass restrictions between view parts, between different views, or between views and workflow rules.

The restriction object contains one or more clauses. Each clause defines a comparison operation for a specific field, for example:

{name: 'wr.prob_type', op: 'LIKE', value: 'ELECTR%'}


You can pass the Ab.view.restriction object to many JS API methods, for example:

myGridPanel.refresh(restriction)
myTabs.selectTab('tab2', restriction);
View.selectValue(..., restriction, ...);
myDataSource.getRecords(restriction);


The Web Central server typically translates the restriction into an SQL WHERE expression that is used to filter data records, but the JS code does not see the generated SQL.

You combine restriction clauses using AND , OR , )AND( , or )OR( relational operations. The addClause() method of the Ab.view.Restriction object allows to specify an optional relOp parameter. If you do not specify the relOp parameter, the default 'AND' value will be used for this clause.

For example, the following code creates a restriction that is equivalent to (requestor = 'ABERNATHY, ALISON' AND status = 'Approved') :

var restriction = new Ab.view.Restriction();
restriction.addClause("wr.requestor", 'ABERNATHY, ALISON', "=");
restriction.addClause("wr.status", 'A', "=");


This example creates a restriction that is equivalent to (requestor = 'ABERNATHY, ALISON' OR requestor = 'BECKWITH, DAVID') :

var restriction = new Ab.view.Restriction();
restriction.addClause("wr.requestor", 'ABERNATHY, ALISON', "=");
restriction.addClause("wr.requestor", 'BECKWITH, DAVID', "=", "OR");


This example creates a restriction that is equivalent to (requestor = 'ABERNATHY, ALISON' AND status = 'Approved') OR (requestor = 'BECKWITH, DAVID' AND status = 'Requested') :

var restriction = new Ab.view.Restriction();
restriction.addClause("wr.requestor", 'ABERNATHY, ALISON', "=");
restriction.addClause("wr.status", 'A', "=");
restriction.addClause("wr.requestor", 'BECKWITH, DAVID', "=", ")OR(");
restriction.addClause("wr.status", 'R', "=");

Example view

schema/ab-products/solutions/programming/grid/ab-ex-prg-grid-restrictions.axvw
schema/ab-products/solutions/programming/grid/ab-ex-prg-grid-restrictions.js

Properties

r elOp

String, read-write . Contain the type of relational operation that will be applied to connect all clauses in the restriction. Possible values are ' AND ' (default), ' OR ', ')AND( ', or ' )OR( '.