Script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…: Changes or sets the value of an XML element.
XML_SET_NODE_TEXT(element, value)
Syntax part |
Description/format |
---|---|
Element |
Reference to the element whose value is to be changed/ set. |
Value | Value for the element. Format: scriptA particular Automation Engine object type. literal or script variableA placeholder for a value within a script. |
Return code |
---|
'0' – The value of the element was successfully set. |
The script element sets the value of a specific element within the XML document that is open. If the element already has a value, this will be changed. You need to specify a reference to the element and the new value.
The element is only stored in the memory using the script function. The Documentation tab is not affected by this.
Line breaks are allowed in the value of the element. Use the UC_CRLF script element to insert line breaks.
The following example opens the structured Documentation tab as an XML document, captures the first element and outputs its value in the activation log. The value of the element will then be changed. If this actionActions are predefined building blocks for recurring activities. They are commonly used for managing third party systems or in deployment scenarios. is successful, the new value will be detected by means of a test and also written to the activation reportA report provides more detailed information about a task's execution or a component..
:SET &XMLDOCU#=XML_OPEN(DOCU,,"@Details")
:IF &XMLDOCU# <> ""
:SET &ELEMENT# = XML_GET_FIRST_CHILD(&XMLDOCU#)
:SET &VALUE# = XML_GET_NODE_TEXT(&ELEMENT#)
:P "Old Value: &VALUE#"
:SET &RET# = XML_SET_NODE_TEXT(&ELEMENT#,"New Node Text")
:IF &RET# = 0
:SET &VALUE# = XML_GET_NODE_TEXT(&ELEMENT#)
:P "New Value: &VALUE#"
:ENDIF
:ENDIF
:XML_CLOSE &XMLDOCU#
Sample output in the activation log:
2013-08-14 13:32:27 – U0020408 Old Value: Old Node Text
2013-08-14 13:32:27 – U0020408 New Value: New Node Text
See also:
Script element | Description |
---|---|
XML_OPEN | Opens an XML document for processing. |
:XML_CLOSE | Closes an XML document. |
Script Element – Reading or Modifying Objects
Examples
Determining the Error Message and Number
About the Script
Script Elements – Alphabetical Listing
Script Elements – Ordered by Function
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |