Adding attributes
To transform extracted attributes, use built-in or custom transformations.
Procedure
- In webMethods B2B, from the side navigation menu, click Assets > Business documents, select an XML document you want to update.
- On the document details page, click on Attributes tab.
- Add an attribute, select a node for which you want to define a XPath query.
- Click Add extracted attribute icon and provide the following
information in the Add extracted attribute dialog:
Field Description XPath expression webMethods B2B fills in the XQL query for the node. Ensure that the length of the XPath attribute is limited to 2,000 characters. Attribute Specifies the required document attribute values to extract from documents that match this document type. Select the required attribute from the list. Do the following if the attribute is not available in the list: - Click
to add document
attribute. - In the Add document attribute dialog box, provide the required details.
- Click Add. The newly added attribute is listed in the Attribute list.
Type Specifies the type of the attribute selected. Description Specifies the description included for the selected attribute. Required By default, when webMethods B2B cannot extract an attribute, it continues processing, and, if processing completes successfully, sets the processing status to DONE. It does not log an error to the activity log. If you want webMethods B2B to log an error to the activity log when it cannot extract an attribute, you can designate that attribute as required for extraction. If processing completes successfully, webMethods B2B sets the processing status to DONE W/ERRORS. Transformation webMethods B2B can transform extracted attributes before storing them in the webMethods B2B database. - If you extract an attribute that has the data type DATETIME or DATETIME LIST, you must identify
the date format. Choose a built-in common date and time format or type the format that you need by
using a pattern string based on the
Time Format Syntaxdescribed for thejava.text.SimpleDateFormatclass. webMethods B2B extracts the value of the date and uses it and the pattern you specify to decode the value and convert it to the format that webMethods B2B requires to store the date in the BizDocEnvelope. If you do not provide a date and time format, the default built-in transformation format dd-MM-yyyy HH:mm:Ss is used. - If you extract an attribute that has the data type STRING or STRINGLIST, you can transform the
string value by using one of the following built-in transformations.
- Uppercase transforms the extracted string attribute value to all uppercase.
- Lowercase transforms the extracted string attribute to all lowercase.
- String Substitution substitutes extracted values with a pattern that you specify. webMethods B2B uses the java.text.MessageFormat class to perform this transformation.For example, you might specify the pattern Items Ordered: {0}, {1}, {2}, and specify an XQL query for the attribute that extracts this array of values: 0 Cellular phone 1 Belt clip 2 Rapid mobile charger webMethods B2B would store the following for the value of the attribute: Items Ordered, Cellular phone, Belt clip, Rapid mobile charger. If you place more arguments in the pattern than there are extracted values, the string that is stored in the database for the attribute contains the extra arguments. If you specify fewer arguments than there are extracted values, the string contains only the values for the number of arguments.
- If you extract an attribute that has the data type NUMBER and contains an array of numbers, use
transform the array into a single value by using one of the following built-in transformations.
- Average calculates the average value of all the numbers in the array.
- Minimum calculates the smallest number in the array.
- Maximum calculates the largest number in the array.
- Sum calculates the sum of all the numbers in the array.
- No format stores the first value of the array as the value of the attribute.
- Click
- Click Update.