op:view-col

op:view-col(
   $viewName as string?,
   $colName as string
) as map:map

Summary

Identifies a column where the combination of view and column name is unique. Identifying the schema isn't necessary (and it might not exist).

If the combination of view and column name is not unique, an ambiguous column error is thrown.

Parameters
$viewName The name of the view.
$colName The name of the column.

Example

xquery version "1.0-ml";

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

let $employees := op:from-view("main", "employees")
let $expenses  := op:from-view("main", "expenses")

return $employees
   => op:join-inner($expenses,
                    op:on(op:view-col("employees", "EmployeeID"),
                          op:view-col("expenses", "EmployeeID")))
   => op:select((op:view-col("employees", "EmployeeID"),
                            "FirstName", "LastName", "Category"))
   => op:order-by(op:view-col("employees", "EmployeeID"))
   => op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy