Loading TOC...

view:set-columns

view:set-columns(
   $schema-name as xs:string,
   $view-name as xs:string,
   $columns as element(view:column)*
) as empty-sequence()

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

  xquery version "1.0-ml"; 
 
  import module namespace view = "http://marklogic.com/xdmp/view" 
      at "/MarkLogic/views.xqy";
 
  view:set-columns("main", "songs",
    ( view:column("uri", cts:uri-reference()), 
      view:column("title", cts:element-reference(xs:QName("TITLE"))),
      view:column("author", cts:element-reference(xs:QName("AUTHOR"))),
      view:column("album", cts:element-reference(xs:QName("ALBUM"), ("nullable"))),
      view:column("year", cts:element-reference(xs:QName("YEAR"))) ) )
 
  (: Sets five columns in the 'songs' view in the 'main' schema. :) 
     

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.