[MarkLogic Dev General] Regarding Spawn function not working

Geert Josten Geert.Josten at marklogic.com
Wed Jan 10 00:30:00 PST 2018


Hi Siva,

The xdmp:node functions only work on persisted nodes. Make sure $userPersonalInfo is a reference to something from the database, or use an in-memory update library: https://github.com/ryanjdew/XQuery-XML-Memory-Operations

Cheers,
Geert

From: <general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com>> on behalf of "Mani, Sivasubramani (ELS)" <s.mani at elsevier.com<mailto:s.mani at elsevier.com>>
Reply-To: MarkLogic Developer Discussion <general at developer.marklogic.com<mailto:general at developer.marklogic.com>>
Date: Wednesday, January 10, 2018 at 7:17 AM
To: "general at developer.marklogic.com<mailto:general at developer.marklogic.com>" <general at developer.marklogic.com<mailto:general at developer.marklogic.com>>
Cc: "Sodihardjo, Aiwen (ELS-AMS)" <a.sodihardjo at elsevier.com<mailto:a.sodihardjo at elsevier.com>>
Subject: [MarkLogic Dev General] Regarding Spawn function not working

Hi  Team,

I try to update the xml nodes more than one time using xdmp:spawn function , but the update was not happened inside the spwan function , I have specified the sample code below. Kindly do the needful

let $updateact_deact := xdmp:spawn-function(function(){
                          ( xdmp:node-replace($userPersonalInfo/us:isActive,
                                        <us:isActive>false</us:isActive>)>),
                                        xdmp:commit())
                          },
                          <options xmlns="xdmp:eval">
                          <transaction-mode>update</transaction-mode>
                          </options>)

let $updatedeact_timestamp := xdmp:spawn-function(function(){
                          (xdmp:node-insert-child($userPersonalInfo/us:lastdeactAcntTimestamp,
                                        <us:lastdeactAcntTimestamp> {current-dateTime()}</us:lastdeactAcntTimestamp>),
                                        xdmp:commit())
                          },
                          <options xmlns="xdmp:eval">
                          <transaction-mode>update</transaction-mode>
                          </options>)


Thanks & Regards,
Siva

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20180110/c6c996d9/attachment.html 


More information about the General mailing list