AccessPlan.prototype.generateView( schemaName as String, viewName as String, [columnDeclarations as object[]] ) as ElementNode
This method generates a view that encapsulates a query. Insert the generated XML into the schemas database and then use the op.fromView op:from-view accessor to use the generated view.
Each column must have an atomic data type that is indexable by TDE. The unqualified name of each column must be unique in the row. The optional column declarations takes the following keys to specify the treatment of rows with invalid values:
name
: the unqualified name of the columntype
: the data type of the column (as specified in a TDE)collation
: the collation for a column with a string data type;
not allowed for other data typesnullable
: a boolean for whether the column can take null values (optional)invalidValues
:
the action (skip
or reject
defaulting to skip) taken when
a row has a value with the wrong data type or has a null for an unnullable column
generateView
is a method of the following classes:
const op = require('/MarkLogic/optic'); op.fromView('main', 'employees') .where(cts.collectionQuery('/division/manufacturing')) .select(['EmployeeID', 'FirstName', 'LastName']) .orderBy('EmployeeID') .generateView('main', 'manufacturingEmployees');
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.