Loading TOC...

MarkLogic Server 11.0 Product Documentation
view:set-view-scope

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

Summary

This function sets the scope of the named view in the named schema specification.

Parameters
schema-name The name of the schema specification containing the view.
view-name The name of the view on which the scope is set.
scope The scope to be set on the view. Use the view:element-view-scope function to set the scope to an element or the view:collection-view-scope function to set the scope to a collection.

For details on view scoping, see Defining View Scope in the SQL Data Modeling Guide.

Example

  xquery version "1.0-ml"; 
 
  import module namespace view = "http://marklogic.com/xdmp/view" 
      at "/MarkLogic/views.xqy";

  view:set-view-scope("main", "songs", view:element-view-scope(xs:QName("SONG"))) 

  (: Sets the scope of the 'songs' view in the 'main' schema to the 
     element, 'SONGS'. :)
     

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