Loading TOC...

ort:get-value

ort:get-value(
   $value as ort:value,
   $index as xs:unsignedLong
) as ort:value

Summary

For an ort:value with value type "SEQUENCE", returns the ort:value at specified index; for value type "MAP", index 0 returns the key, and index 1 returns the value.

Parameters
$value An ort:value, with value type "SEQUENCE" or "MAP".
$index The index.

Example

  let $m := ort:map(ort:string(("key1","key2"),(2)),ort:value((1,2),(2),"float"))
  return ort:get-value($m,0)
  =>
  OrtValue(Shape:[2], Type: STRING)

Example

  let $m := ort:map(ort:string(("key1","key2"),(2)),ort:value((1,2),(2),"float"))
  return ort:get-value($m,1)
  =>
  OrtValue(Shape:[2], Type: FLOAT)

Example

  let $s := ort:sequence((ort:value((2,3),(2),"float"),ort:value((1),(1),"float"),ort:value((2),(1),"float")))
  return ort:get-value($s,1)
  =>
  OrtValue(Shape:[1], Type: FLOAT)

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