Topics: |
Syntax:
com.ibi.agents.XDDocUpdateAgent
iIT Service Object:
document: Doc Update Agent
sreg: Doc Update Agent
transform: Activity Log Control
Description:
The Document Update service can be used to run find and replace procedures, and modify data based on static or dynamic parameters.
Note: This service requires a highly technical method to achieve the desired result. The same functionality can be performed through the use of a configured Transform component, which can be called by a Transform service. For more information, see Transform Service (com.ibi.agents.XDTransformAgent).
Parameters:
Parameter |
Description |
---|---|
Document Output * |
The manner in which to process documents. XML can be processed as flat text, but the output document will result as designated. Select one of the following options from the drop-down list:
|
Processing Method * |
Modify document data before or after the find/replace operation. Select one of the following options from the drop-down list:
|
Document Assembly Instructions |
A comma-separated field used to describe how the document is assembled. The build text is evaluated from left to right. iFL functions (for example, _SREG and _CONCAT) are evaluated at document build time. The following special text values are also used: DS0 - document at time of build, DS# where:
|
DS1 |
Data source 1, which is evaluated when the component is called. This field may contain any iFL functions (for example, _SREG and _CONCAT) and text. This field is represented in the Document Assembly Instructions parameter as DS1. |
DS2 |
Data source 2, which is evaluated when the component is called. This field may contain any iFL functions (for example, _SREG and _CONCAT) and text. This field is represented in the Document Assembly Instructions parameter as DS2. |
DS3 |
Data source 3, which is evaluated when the component is called. This field may contain any iFL functions (for example, _SREG and _CONCAT) and text. This field is represented in the Document Assembly Instructions parameter as DS3. |
DS4 |
Data source 4, which is evaluated when the component is called. This field may contain any iFL functions (for example, _SREG and _CONCAT) and text. This field is represented in the Document Assembly Instructions parameter as DS4. |
Find/Replace |
|
Search |
Text to search for. Use a comma (,) to repeat searches (for example, search1,search2,search3). |
Replace |
Text to replace search text. Multiple searches must have an equal number of replacements. |
Encoding |
Specifies the encoding when converting a flat document to XML format. Platform encoding is used by default. Note: The Encoding parameter is required for the Document Update service to function properly. |
Data Sources |
Data used to build the document. Use a comma (,) to repeat data sources (for example: _SREG(VAR_A),_SREG(VAR_B),_SREG(VAR_C)). Use DS0 to include the original incoming document. |
The following image shows the New Service Object dialog in iIT Designer and the corresponding parameters that displays when you add a new Document Update service object to a process flow.
Edges:
The following table lists the available line edges for the Document Update Service (com.ibi.agents.XDDocUpdateAgent).
Line Edge |
Description |
---|---|
OnError |
Error: Returned by the service if any of the following fields contain an invalid iFL statement:
If Process to XML was selected and the document created is not a well formed XML document. |
OnSuccess |
Success: The service generated a successful output. Either a flat document was generated by the service (if Process to Flat text was selected), or a well formed XML document (if Process to XML was selected) was produced. |
OnFailure |
Failure |
OnCustom |
|
This example performs a Find/Replace operation then parses the document. In this example, DS0, DS1, DS2, DS3, and DS4 are used to append the text this is a bill to the end of the document (DS0 represents the input document of the service). Because the Find/Replace operation is performed prior to compiling the output document, the second occurrence of bill is not replaced with buster.
Document:
<Test>joe bill mike<Test>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to Flat text |
Processing Method |
Find/Replace then Build Document |
Document Assembly Instructions |
ds0,ds1,ds2,ds3,ds4 |
DS1 |
_concat(this,' ') |
DS2 |
_concat(is,' ') |
DS3 |
_concat(a,' ') |
DS4 |
bill |
Search |
bill |
Replace |
buster |
Encoding |
UTF-8 |
Results:
<Test>joe buster mike<Test>this is a bill
This example parses the document then performs a Find/Replace operation. In this example, DS0, DS1, DS2, DS3, and DS4 are used to append the text this is a bill to the end of the document (DS0 represents the input document of the service). Because the Find/Replace operation is performed after compiling the output document, the second occurrence of bill is replaced with buster.
Document:
<Test>joe bill mike<Test>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to Flat text |
Processing Method |
Build Document then Find/Replace |
Document Assembly Instructions |
ds0,ds1,ds2,ds3,ds4 |
DS1 |
_concat(this,' ') |
DS2 |
_concat(is,' ') |
DS3 |
_concat(a,' ') |
DS4 |
bill |
Search |
bill |
Replace |
buster |
Encoding |
UTF-8 |
Results:
<Test>joe buster mike<Test>this is a buster
This example only performs a Find/Replace operation. In this case, only the document presented to the service is searched and any occurrence of bill is replaced with buster.
Document:
<Test>joe bill mike<Test>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to Flat text |
Processing Method |
Only Find/Replace |
Document Assembly Instructions |
|
DS1 |
_concat(this,' ') |
DS2 |
_concat(is,' ') |
DS3 |
_concat(a,' ') |
DS4 |
bill |
Search |
bill |
Replace |
buster |
Encoding |
UTF-8 |
Results:
<Test>joe buster mike<Test>
This example parses the document as XML or flat (no replace is performed). The assembly instructions indicate that DS1, DS2, DS3, and DS4 are used to create the document that the service will output. There will be no replacements performed by the service.
Document:
<Test>joe bill mike<Test>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to Flat text |
Processing Method |
Only Build Document |
Document Assembly Instructions |
ds1,ds2,ds3,ds4 |
DS1 |
_concat(this,' ') |
DS2 |
_concat(is,' ') |
DS3 |
_concat(a,' ') |
DS4 |
bill |
Search |
bill |
Replace |
buster |
Encoding |
UTF-8 |
Results:
this is a bill
The assumption for the examples to follow is that the iSM SREG called xmlrecord is set to:
<root><Joe>QA</Joe>
This example performs a Find/Replace operation then parses the document. In this example, the iSM iFL function _SREG and DS0 (the document presented to the service) are used in the document assembly process. Because the Find/Replace operation is performed prior to compiling the output document, only the second occurrence of QA is replaced with Quality Assurance.
Document:
<Michael>QA</Michael></root>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to XML |
Processing Method |
Find/Replace then Build Document |
Document Assembly Instructions |
_sreg(xmlrecord),DS0 |
DS1 |
|
DS2 |
|
DS3 |
|
DS4 |
|
Search |
QA |
Replace |
Quality Assurance |
Encoding |
UTF-8 |
Results:
<?xml version="1.0" encoding="ISO-8859-1" ?> <root> <Joe>QA</Joe> <Michael>Quality Assurance</Michael> </root>
This example parses the document then performs a Find/Replace operation. In this example, the iSM iFL function _SREG and DS0 (the document presented to the service) are used in the document assembly process. Because the Find/Replace operation is performed after compiling the output document, both occurrences of QA are replaced with Quality Assurance.
Document:
<Michael>QA</Michael></root>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to XML |
Processing Method |
Build Document then Find/Replace |
Document Assembly Instructions |
_sreg(xmlrecord),DS0 |
DS1 |
|
DS2 |
|
DS3 |
|
DS4 |
|
Search |
QA |
Replace |
Quality Assurance |
Encoding |
UTF-8 |
Results:
<?xml version="1.0" encoding="ISO-8859-1" ?> <root> <Joe>Quality Assurance</Joe> <Michael>Quality Assurance</Michael> </root>
This example only performs a Find/Replace operation. In this case, only the document that is presented to the service is searched and any occurrence of QA is replaced with Quality Assurance.
Document:
<Michael>QA</Michael>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to XML |
Processing Method |
Only Find/Replace |
Document Assembly Instructions |
|
DS1 |
|
DS2 |
|
DS3 |
|
DS4 |
|
Search |
QA |
Replace |
Quality Assurance |
Encoding |
UTF-8 |
Results:
<?xml version="1.0" encoding="ISO-8859-1" ?> <Michael>Quality Assurance</Michael>
This example parses the document as XML or flat (no replace is performed). In this example, the iSM iFL function _SREG and DS0 (the document presented to the service) are used in the document assembly process. There will be no replacements performed by the service.
Document:
<Michael>QA</Michael></root>
Parameters:
Parameter |
Value |
---|---|
Document Output |
Process to XML |
Processing Method |
Only Build Document |
Document Assembly Instructions |
_sreg(xmlrecord),DS0 |
DS1 |
|
DS2 |
|
DS3 |
|
DS4 |
|
Search |
QA |
Replace |
Quality Assurance |
Encoding |
UTF-8 |
Results:
<?xml version="1.0" encoding="ISO-8859-1" ?> <root> <Joe>QA</Joe> <Michael>QA</Michael> </root>