op:from-param( $param-name as item(), $qualifier as xs:string?, $rowColTypes as map:map+ ) as map:map
This function constructs document rows with rows provided by a parameter.
Parameters | |
---|---|
$param-name | The paramName parameter specifies the placeholder parameter supplying the rows. |
$qualifier | Specifies a name for qualifying the column names. |
$rowColTypes | Describes the columns with a sequence of maps. It's a combinations of column, type and nullable. The 'column' is the column name, which is required. The 'type' is the optional type of the column, which can be an atomic type or the default of none. The 'nullable' is an optional boolean defaulting to false. If your rows contains only uri, doc, collections, metadata, permissions, quality and temporalCollection columns, you could simply use op:doc-col-types instead. |
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; let $rows := ( map:entry("id", 1) => map:with("firstName", "Jane")=> map:with("lastName", "Woods"), map:entry("id", 2) => map:with("firstName", "Ken")=> map:with("lastName", "First")) let $row-col-types := ( map:entry("column", "id") => map:with("type", "integer")=> map:with("nullable", false()), map:entry("column", "firstName") => map:with("type", "string")=> map:with("nullable", true()), map:entry("column", "lastName") => map:with("type", "string")=> map:with("nullable", true()) ) return op:from-param(op:param("param"), "qualifier1", $row-col-types) =>op:result("object", map:entry("param", $rows))
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; let $rows := ( map:entry("id", 1) => map:with("firstName", "Jane")=> map:with("lastName", "Ken")) let $row-col-types := ( map:entry("column", "id"), map:entry("column", "firstName"), map:entry("column", "lastName") ) let $from-view := op:from-view("soccer", "matches") let $from-param := op:from-param("param", "test", $row-col-types) return $from-param=>op:join-left-outer($from-view) => op:where(op:eq(op:view-col("test", "id"), op:schema-col("soccer", "matches", "id"))) => op:result("object", map:entry("param", $rows))
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.