Adding EDI document attributes

In the EDI business document, you can specify the system and custom document attribute to extract from the document. If you want to transform extracted attributes, use built-in or custom transformations. You can also add an attribute or replace an existing one.

Procedure

  1. In webMethods B2B, from the side navigation menu, click Assets > Business documents. Select an EDI document to which you want to add an attribute.
  2. Click the Attributes tab. Select a node for which you want to define an XPath query. Click Add attribute, and provide the following information in the Add attribute dialog:
    XPath expression
    webMethods B2B completes the XQL query for the node.
    To extract a list of attributes for a record and its fields, do not index any value in the XPath query. For example, to extract all the Tax Monetary Amount from an X12 810 Invoice document, the XPath query must be /ST/IT1/TXI/TXI02. To extract all the attributes for 2 RFF and 2 DTM, the XPath query must be /UNH/RFF/DTM/DTM01/C50703. The system extracts the attribute for the following XPaths:
    • /UNH/RFF[0]/DTM[0]/DTM01/C50703,
    • /UNH/RFF[0]/DTM[1]/DTM01/C50703,
    • /UNH/RFF[1]/DTM[0]/DTM01/C50703, and
    • /UNH/RFF[1]/DTM[1]/DTM01/C50703
    Attribute
    The required document attribute to extract from the document. You can select the attribute from the list or add the attribute when it is not available in the list. To add the attribute, click Add document attribute, add the details, and click Add. The new attribute now appears in the attributes list.

    Do not use the characters other than A-Z, a-z, 0-9, _ (underscore), - (hyphen) in the attribute names.

    Type
    The type of the attribute selected.
    Description
    The description included for the selected attribute.
    Required
    When you set this property to yes, and webMethods B2B cannot extract an attribute but successfully processes the document, it logs an error in the activity log. The processing status is set to DONE W/ERRORS.

    By default, when webMethods B2B fails to extract an attribute, it continues to process the document. If the processing of the document is successful, webMethods B2B sets the processing status to DONE and does not log an error to the activity log.

    Transformation
    webMethods B2B can transform extracted attributes before storing them in its database.

    If you extract an attribute that has the data type DATETIME, identify the date format. You can either select a built-in common date and time format or type the format by using a pattern string based on the Time Format Syntax described for the java.text.SimpleDateFormat class. webMethods B2B extracts the value of the date, decodes it using the specified pattern, and converts it to the required format to store the date in the BizDocEnvelope. If you do not provide a date and time format, webMethods B2B uses the default built-in transformation format dd-MM-yyyy HH:mm:Ss.

    If you extract an attribute with the data type STRING, you can transform the string value 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 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, and 2 rapid mobile charger. webMethods B2B stores the value of the attribute items ordered as cellular phone, belt clip, and rapid mobile charger. If you place more arguments in the pattern than the extracted values, the string that is stored in the database for the attribute contains the extra arguments. If you specify fewer arguments than the extracted values, the string contains only the values for the number of arguments.
    If you extract an attribute with data type NUMBER, 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.
    When webMethods B2B extracts a NUMBER from a document, it uses the number-parsing behavior of java.lang.Number. For example, if the NUMBER contains the value 100zzz, webMethods B2B interprets the value as 100, instead of displaying an error as it does if the value were zzz100.

What to do next

To replace an existing attribute, select an existing attribute from the list and click Update attribute. Modify the attribute name and click Update. The XPath expression of the selected attribute is replaced with the selected node. Click Update to save the modifications.