MarkLogic 9 Product Documentation
view.setColumns

view.setColumns(
   schema-name as String,
   view-name as String,
   columns as element(view.column)[]
) as null

Summary

This function replaces the current set of column specifications on the named view in the named schema with a new set of columns.

Parameters
schema-name The name of the schema specification containing the view.
view-name The name of the view containing the column specifications to be reset.
columns A sequence of column specifications for the view.

Example

const view = require('/MarkLogic/views');

  view.setColumns('main', 'songs',
    [view.column('uri', cts.uriReference()), 
      view.column('title', cts.elementReference(xs.QName('TITLE'))),
      view.column('author', cts.elementReference(xs.QName('AUTHOR'))),
      view.column('album', cts.elementReference(xs.QName('ALBUM'), ('nullable'))),
      view.column('year', cts.elementReference(xs.QName('YEAR')))] );
 
// Sets five columns in the 'songs' view in the 'main' schema.
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy