op:from-view

op:from-view(
   $schema as xs:string?,
   $view as xs:string,
   [$qualifier as xs:string?],
   [$systemCols as map:map?]
) as map:map

Summary

This function reads a row set from a configured view over TDE-indexed rows or a predefined view over range indexes.

This function creates a row set without a limit. Use op:limit or op:offset-limit to set a limit.

Parameters
$schema The name identifying the schema containing the view. If the schema name is null, the engine searches for a view with the specified name.
$view The name identifying a configured template or range view for rows projected from documents.
$qualifier Specifies a name for qualifying the column names in place of the combination of the schema and view names. Use cases for the qualifier include self joins. Using an empty string removes all qualification from the column names.
$systemCols An optional named fragment id column returned by op:fragment-id-col. One use case for fragment ids is in joins with lexicons or document content.

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-view("main", "employees")
   => op:select(("EmployeeID", "FirstName", "LastName"))
   => op:order-by("EmployeeID")
   => op:result()

  

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-view("main", "employees", (), op:fragment-id-col('docId'))
   => op:select(("EmployeeID", "FirstName", "LastName", "Position", "docID"))
   => op:order-by("EmployeeID")
   => op:result()

  
Powered by MarkLogic Server | Terms of Use | Privacy Policy