
op.context() as ContextExprCall
This helper function returns the node from the current processing row. It is to be used in ColumnBuilderPlan.prototype.xpath , to reference the 'current item' instead of a doc column.
const op = require('/MarkLogic/optic');
op.fromDocs(
cts.collectionQuery("test"),
"/my:root",
,op.columnsBuilder()
.addColumn("test") // add column test with type string xpath="test"
.addColumn(op.col("test1")) // add column test2 with type string xpath="test2"
.addColumn("test2").xpath("my:val2").type("")
.addColumn("test3").expr(op.xpath(op.context(),"my:val3"))
.addColumn("test4").expr(op.xpath(op.context(),"my:val4",{my:"http://www.my.com/override"}))
.addColumn("test5").expr(op.param("inputValue"))
, "MyView",
"myFragmentId",
{my:"http://www.my.com/my"},
)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.