Loading TOC...

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()
  

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