Share this link

    Home / Tradeshift Documentation / Tradeshift Partner Apps / Babelway / Chapter 4. Channels

    Message definition formats: Part 1

    2571 0 Created on 2020-09-29 11:31:21; Last updated on 2022-07-01 13:01:13

    This list shows main message formats supported by the application.

    • CSV
    • EDIFACT
    • X12
    • Odette
    • XML
    • Excel
    • Message In of type PDF
    • PDF based on XHTML template
    • Serving Xml
    • Multirecord
    • Tradacom
    • Json
    • Rest
    • SAP Idoc flat file
    • Not Defined
    • UBLRosetta
    • Net

    CSV

    A CSV or comma-separated values file is used for the digital storage of data organized in a table form. Each line in the CSV file corresponds to a row in the table, and within a line, fields are separated by commas (or semicolons, colons or tabs), each field belonging to one column of the source table.

    As this is a very common and simple file format, CSV files are often used to move tabular data between different computer programs, such as between a database and a spreadsheet program.

    Note: When using a CSV as a Message IN definition, each line will be identified in a separate record at the same level and the Message IN after transformation to XML will not have any hierarchical structure.

    File sample

    Following is a sample CSV file.

    NAV Date,ISIN,Fund Name,Share Typ,Fund Ccy,NAV in Fund Ccy,Bid Price in Fund Ccy,Offer Price in Fund Ccy,TNA,Outstanding,Publication Ccy,NAV in Publication Ccy,Bid Price in Publication Ccy,Offer Price in Publication Ccy,Equity Profit,WKN Code,Zwischengewinn,TIS,TID
    06/13/2008,LU0223208157,HSBC GIF EMERGING EUROPE EQUITY,AC,EUR,15.088,15.088,15.924,12190498.17,807980.236,GBP,11.96,11.96,12.623,37.650,A0ER9A,0.001,,

    The following properties are available:

    Delimiter Character: The character that is used to separate the fields in the csv. It can be a comma, colon, semicolon or tab. 

    Quote character: The character that is used to quote the specials characters in the csv. It can be a single quote (') or a double quote ("). 

    Headers: Tells you if the csv file begins with a line that contains headers of the columns, or directly begins with the lines of data. 

    Encoding: The encoding of the csv file.

    Sample: An example of CSV file handled by this message definition. 

    Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings. 

    Edifact

    Introduction

    United Nations / Electronic Data Interchange for Administration, Commerce and Transport (UN/EDIFACT) is the international EDI standard developed under the United Nations impulse. This standard is maintained and further developed by a UN body. EDIFACT has now been adopted by the International Organization for Standardization (ISO) as the ISO standard ISO 9735.

    The EDIFACT standard provides a set of syntax rules to structure data, an interactive exchange protocol (I-EDI), and standard messages which allow multi-country and multi-industry exchange.

    You can find more information about Edifact on its official site ( http://www.unece.org/cefact/edifact/welcome.html ) or on Wikipedia ( https://en.wikipedia.org/wiki/EDIFACT ). See how Walmart and Amazon use Edifact to connect with their suppliers.

    Below is a sample EDIFACT file.

    UNB UNOA:1 005435656:1 006415160:1 060515:1434 00000000000778'
    UNH 00000000000117 INVOIC:D:97B:UN'
    BGM 380 342459 9'
    DTM 3:20060515:102'
    RFF ON:521052'
    NAD BY 792820524::16  CUMMINS MID-RANGE ENGINE PLANT'
    NAD SE 005435656::16  GENERAL WIDGET COMPANY'
    CUX 1:USD'
    LIN 1  157870:IN'
    IMD F  :::WIDGET'
    QTY 47:1020:EA'
    ALI US'
    MOA 203:1202.58'
    PRI INV:1.179'
    LIN 2  157871:IN'
    IMD F  :::DIFFERENT WIDGET'
    QTY 47:20:EA'
    ALI JP'
    MOA 203:410'
    PRI INV:20.5'
    UNS S'
    MOA 39:2137.58'
    ALC C ABG'
    MOA 8:525'
    UNT 24 00000000000117'
    UNZ 1 00000000000778'

    Extensive support

    Babelway supports all Edifact messages, and knows all the definitions of the different norms. This knowledge of these definitions will allow additional functionalities when you work with Edifact. Amongst other things :

    By just loading a sample Edifact file, Babelway will be able to deduce the structure, find the definition of the elements, calculate human-readable labels, you can see on the following screenshot the result when you load the sample above.

    

    Edifact tree just after having loaded a Sample.

    • Adding or removing segment elements is very easy, as the interface knows precisely which elements may take place in the selected segment.

    

    Edit segment shows all the possible elements

    • In the same way, segments can be easily added. The interface will offer you segments and elements that may take place at this location.

    

    Edit segment shows all the possible elements

    • Messages can be validated deeply (structure, mandatory fields, values) automatically, without having to define any validation manually.
    • For all the runtime messages, comments are added in the internal representation to ease the reading of the file.

    

    Internal representation of an Edifact

    Note: For some specific segment if the position is changed in the "Message In" tree and/or if the position of the segment is changed in the input message this will leads to a different naming in the "Message IN after transformation to XML" file for this segment and then in this case the mapping will not generate the values in the output message.

    Properties

    The following properties are available:

    • Validate structure: Only for messages OUT. If yes, an error will be generated if your message has an incorrect structure. Deactivate only if you really want to send messages with incorrect structures. 
    • Validate values:  If yes, all values will be checked against their definition. Deactivate only if you really want to receive/send messages with values that do not respect the Edifact standard. 
    • Validate segments: If yes, all segments will be checked against their definition (mandatory fields must exist, no field can be present if not in definition). Deactivate only if you really want to receive/send messages with values that do not respect the Edifact standard. 
    • Sign Edifact: If checked, you will be able to configure the settings for a signed edifact.
    • Security Version: If set, signature will be applied to the edifact generated file and security segments will be inserted (USH, UST, USR, USA, USC, UNO and UNP). 
    • Security certificate: Which certificate will be used for security segments. 
    • Sample: An example of Edifact file handled by this message definition. 
    • UNA segment: Only for messages OUT. The UNA segment to be used in your output message. If you asked for an empty UNA segment, it will not be printed, and default separators will be used. If you specify one, the rest of the file will be written accordingly, adapting to the separators defined in the segment. 
    • Add line breaks between segments: Only for messages OUT. If yes, an additional line break will be added in the output message between every segment. Only for human readability. 
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings. 

    Note: Regarding the "Message In" we can't disable the "Validate structure" because it is mandatory, Regarding the "Message Out" we can disable the "Validate structure" from the "Properties".

    X12 Message Format

    ASC X12 (also known as ANSI ASC X12) is the official designation of the U.S. national standards body for the development and maintenance of Electronic Data Interchange (EDI) standards. ASC X12 has sponsored more than 315 X12-based EDI standards for health care, insurance, government, transportation, finance, and many other industries (see how Walmart, Amazon, Rite Aid, and Wayfair use X12).

    Babelway supports all X12 messages, and offers the same extensive support as for Edifact.

    File sample

    Below is a sample X12 file.

    ISA*00*          *00*          *ZZ*SENDERISA      *ZZ*RECEIVERISA    *960807*1548*U*00401*000000020*0*T*~
    GS*IN*SENDERDEPT*007326879*19960807*1548*000001*X*004010~
    ST*810*000000001~
    BIG*20090927*00027**A00027-01~
    N1*ST*CHOCOLATE IMPORT*9*1234567890~
    N3*1000 N. NORTH HIGHWAY~
    N4*NEW YORK*NY*10310~
    N1*BT*RETAILER INC.*9*1098765432~
    N3*P.O. BOX 0000~
    N4*LAKE*VA*20120~
    N1*RE*FOODSELLER*9*12345QQQQ~
    N3*P.O. BOX 222222~
    N4*FAIRFAX*VA*94978~
    ITD*01*3*1**15**16~
    FOB*PP~
    IT1**16*CA*12.34**UA*006540022222~
    PID*F****BELGIUM CHOCOLATE~
    IT1**13*CA*12.34**UA*006540033333~
    PID*F****SWISS CHOCOLATE~
    TDS*35786~
    CAD*****FREEFORM~
    ISS*29*CA~
    CTT*2~
    SE*22*000000001~
    GE*1*000001~
    IEA*1*000000020~

    Babelway supports X12 messages. This knowledge of these definitions will allow additional functionalities when you work with X12. Amongst other things :

    • By just loading a sample X12 file, Babelway will be able to deduce the structure, find the definition of the elements, calculate human-readable labels, you can see on the following screenshot the result when you load the sample above.

    

    X12 tree just after having loaded a Sample\

    • Adding or removing segment elements is very easy, as the interface knows precisely which elements may take place in the selected segment.

    

    Edit segment shows all the possible elements

    • In the same way, segments can be easily added. The interface will offer you segments and elements that may take place at this location.

    Edit segment shows all the possible elements

    • Messages can be validated deeply (structure, mandatory fields, values) automatically, without having to define any validation manually.
    • For all the runtime messages, comments are added in the internal representation to ease the reading of the file.

    

    Internal representation of X12

    Note: For some specific segment if the position is changed in the "Message In" tree and/or if the position of the segment is changed in the input message this will leads to a different naming in the "Message IN after transformation to XML" file for this segment and then in this case the mapping will not generate the values in the output message. 

    The following properties are available:

    • Validate structure: Only for messages OUT. If yes, an error will be generated if your message has an incorrect structure. Deactivate only if you really want to send messages with incorrect structures. 
    • Validate values: If yes, all values will be checked against their definition. Deactivate only if you really want to receive/send messages with values that do not respect the X 12 standard. 
    • Validate segments: If yes, all segments will be checked against their definition (mandatory fields must exist, no field can be present if not in definition). Deactivate only if you really want to receive/send messages with values that do not respect the X 12 standard. 
    • Sample: An example of X 12 file handled by this message definition. 
    • Edi template: Template of output file, that will be used to choose delimiters. If no template is selected and the message IN was a X12, the system will reuse the delimiters from the message IN. Otherwise the default delimiters are '~' '*' ':'. 
    • Output Charset: Output Charset is used to encode the file. 
    • Input Charset: Input Charset is used to decode the file. 
    • Send 997: Automatically generate a 997 functional acknowledgement upon receiving a message. This will not work for messages which are themselves 997s. See 997 Acknowledgements for more information. 
    • Transfer Metadata:  Additional metadata and universal routing metadata are always attached to the new 997 message generated. This option allows you to additionally attach the user metadata of the original message to the 997. 
    • Ack will be sent by: 997 messages will be sent into a channel through this gateway IN. 
    • Expect 997: If selected, the message remains 'In delivery' until a matching 997 is received or until the timeout is reached. The message status will change to 'Success' upon reception of an 'Accepted' 997. The message status will change to 'Error' upon reception of a 'Rejected' 997 or no 997 received before time out. See 997 Acknowledgements for more information. 
    • Timeout: Indicates how long the message will await the 997 before the message status is changed from 'In delivery' to 'Error'. See 997 Acknowledgements for more information. 
    • Gateways: Lists the gateways for which a channel was identified or created which correlates incoming acknowledgements. 
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings. 

    Note:

    • There is no escaping character for the X12 message, For example if you defined the X12 segment separator as ^ character and for one of the element has the ^ character in it's value then the Babelway system will replace this ^ character by a space for the value of this element.
    • Regarding the "Message In" we can't disable the "Validate structure" because it is mandatory, Regarding the "Message Out" we can disable the "Validate structure" from the "Properties".
    • Below are different ways to define the segment separator for X12 message regarding the "Message Out".

    1-By uploading X12 message template to the "Edi template" then Babelway will use the segment separator that you have defined in this template.

    

    Edi template for X12 "Message Out" Properties

    2-If you didn't define Edi template and the "Message Out" definition is of type X12 then Babelway will use the separator character from the X12 message.

    3-If you are using "Message Out" definition that isn't of type X12 then Babelway will use the standard separator for the X12 message.

    Odette

    The Organization for Data Exchange by Tele Transmission (ODETTE) in Europe is a group that represents the interests of the automotive industry in Europe. They are the equivalent of the Automotive Industry Action Group (AIAG) in North America.

    ODETTE has been responsible for developing communication standards such as OFTP and OFTP2.0.

    Babelway supports all following ODETTE Messages:

    AVIEXP, AVIGRU, AVIREX, BASDAT, CONFOR, CONTRL, CREDIT, DEBNOT, DELINS, ENQIRY, FORDIS, GRUDES, INVOIC, KANBAN, MODPRI, OFFERR, ORDERR, OSTENQ, PRILST, REMADV, REPDEL, REPINV, REPORD, STATAC, STOACT, SYNCRO, SYNPACFile sample

    File sample

    Below is a sample ODETTE file.

    UNB UNOA:1 1111:OD 2222:OD 980611:1723 888  KANBAN'
    UNH 1 KANBAN:2::OD'
    MID 0000001266 040331:0001'
    CDT ::::::2474'
    BDT 0931955500293'
    CSG 0931955500293 I'
    ARD 190569'
    KDE :336 3840  040402:1648'
    ARD 192209'
    KDE :492 1600  040402:2057'
    UNT 10 1'
    UNZ 1 888'
    The following properties are available:
    • Edi Template (Only available for Odette Out): The template is used by the EdiWriter in order to define the proper layout of the odette and follows the syntax of the template. 
    • Skip UNA (Only available for Odette Out): Check this to skip the UNA section in ODETTE. 
    • Output Charset: Output Charset is used to encode the file. 
    • Input Charset:  Input Charset is used to decode the file. 
    • Sample: An example of ODETTE file handled by this message definition. 
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings. 

    XML

    XML stands for eXtensible Markup Language and is a very common type of files.

    File sample

    Below is a sample XML file.

    5420008199981
    5400102000086
    20080531170538
    VK20084010
    P
    NL
    1.1/Food
    
    VK20084010
    
    INV
    VK20084010
    ORI
    EUR
    
    20080531170538
    20080531170538
    20080530170738
    20080530170538
    
    
    
    
    GDS
    1
    95400102057205
    
    The following properties are available:
    • Output Charset:  Charset to use to encode the file. 
    • Input Charset: Charset to use to decode the file. 
    • XSD: Xsd definition file corresponding to the XML message. 
    • XsdImports: Xsd Imports that the Xsd definition depends on. 
    • Sample: An example of XML file handled by this message definition. 
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings. 

    If you want to create and XML message definition, we advise you to provide a complete XML sample and XSD file(s) defining the structure of the XML. You will get validation, documentation, loop generation from XSD files and the resulting message definition will be limited to fields present in the XML sample.

    If you provide XSD files only, be aware that, if XSD structure is fairly complex, the resulting message definition will be very difficult to use.

    If you provide an XML sample file only, you will need to manually edit the message definition to add the 'loops' where it makes sense.

    Excel Message Format

    File sample

    Below is a sample Excel file having headers at the first row of the Excel sheet.

    

    Excel Sample File

    The following properties are available:

    • Excel version (Only available for Excel In): Which Excel format is used (XLS or XLSX). 
    • Ignore empty lines (Only available for Excel In): Check this to ignore empty lines. 
    • Trim (Only available for Excel In): Check this to remove all spaces from text except for single spaces between words. 
    • Dateformats (Only available for Excel In): Used date format. 
    • SheetMode (Only available for Excel In): Single/Multiple sheets? If not selected, only the first sheet of the workbook is considered. 
    • ExcelTemplate (Only available for Excel Out): This action allows to list all the tickets, optionally filtered by some search criteria. Note: This only support xls format. 
    • Headers: Select if first row contains field headers. 
    • Encoding: Charset used to encode/decode the file. 
    • Sample: An example of Excel file handled by this message definition. 
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings. 

    File sample

    Babelway Excel wizard only supports the Excel files with extension ".XLS"

    So if the Excel file you are intended to use has an extension ".XLSX", you will have to change the Excel extension to ".XLS" before uploading it in the Excel wizard. Here is the procedure.*Excel file extension modification procedures.

    1- Open your Excel file with extension ".XLSX" and click on "save as".

    

    

    2- Open the "Save As type" drop down menu and choose the extension XLS and click on save.

    

    Save file with a new extension

    Message In of type PDF

    Creating "Message In" of type PDF

    1-From the "Message In" Select "PDF" for the "Your message is of type" field, as shown below.

    

    2-For the "PDF Sample" field click on the "Choose File" button and upload your PDF sample file, as shown below

    

    3-For the "Template name" write your template name in this case it will be "Invoice_Template_1", as shown below.

    

    Note: You can name the Template name any name you want and it only can contain characters from A to Z in upper case and/or a to z characters in lower case and/or numbers between 0 to 9 and _ character, This is the only allowed characters.

    4-If you want to receive a notification email when the message fell in a validation error regarding the PDF then you will need to enable the "Trigger based on message definition validation errors" and then for the "Recipients" enter the email address that will receive the notification, as shown below.

    

    Note: For the "Trigger based on message definition validation errors" you can use one or more email addresses to receive the notification emails, To add more than one email address you will click on the icon, as shown below.

    

    After the "Message In" is created then from "Properties" you can update the configuration in the future when needed.

    5-Now the Template will be created in the templates section, and the "Message In" structure will be empty for now because we will need to define it in the below steps in the "Extracting Fields" section, as shown below.

    

    Note: The template allows you to define multiple templates that will match the same message definition, The template is very helpful when there are more than one PDF messages sharing the same message definition by creating a template for each PDF message then you can process all them in one channel.

    PDF Template Settings

    The Template matching conditions is used to indicate which elements are static elements that is used to define the PDF file which will allow the system to know how to make a link between the PDF template and the input PDF message.

    Note: This is the ID of the document, For the incoming PDF messages it this match the ID then the message will be processed by it's corresponding template based on the set of rules defined in the Template matching conditions.

    For example you can use one of the following (Company logo, Company address, Document type, etc.) and when this elements is used to identify the PDF file then this element must be provided in all of the input PDF message in order to the system to be able to identify the message, If for example you used the Company logo with the Document type to identify the message then you will need to provide this two fields in all of the processed PDF input messages in order for the system to be able to identify the PDF message.

    1-At the bottom of the "Message In" click on the "Edit PDF template" button to begin editing the template, as shown below.

    

    2-Click on the gear icon to open the "PDF Template Settings" pop-up page, as shown below.

    

    Note:

    • The below section has all of the template names, In this case we only have one template which name is "Invoice_Template_1", as shown below.

    

    3-We will see in this case that the system automatically have selected the Company logo to identify this PDF Template, as shown below.

    Note: You can remove the automatically created rule if this will achieve your logic and then you can add the needed rules.

    4-To add more elements click on the "Add more" button, as shown below.

    5-Select a uniquely element in this PDF to identify the PDF, In this case we will use the "INVOICE" label, as shown below.

    

    6-Now you will need to click on the "Save Settings" button to save this changes, as shown below.

    

    

    How to process PDF input message which will contain multiple Invoices as an example in this case?

    1-From the "Message In" click on the "Edit PDF template" button, as shown below.

    

    

    

    2- Click on the gear icon to open the "PDF Template Settings" pop-up page, as shown below.

    

    

    3-From the "PDF Template Settings" in the "Can this pdf include several documents of the same template?" click on "Yes" to inform the system that this PDF input message will have several messages, as shown below.

    

    

    Note: The system will split the input message and process each message in a separate PDF file.

    4- Now you will need to click on the "Save Settings" button to save this changes, as shown below.

    

    

    Extracting Fields

    To extract fields from the PDF Template you have three options to select one of them based on your need.

    1-Fixed

    2-Relative to a label / image

    3-Within a table

    Below is explanation for each option:

    1-Fixed

    The value always starts at the same position within the PDF template (exact same coordinates each time). The value can then vary in length as long as the start position is consistent.

    2-Relative to a label / image

    The position of this value can vary, but it is always close to a label (field name) or image. Ex. The value 12/08/2017 is always to the right of the label 'Date'.

    In fact we only care to find the exact text of the value and from there we look to the right/left/above/below depending on how the rule is set to find the value, as shown below.

    

    The field which has the value "101" is relative to the label "INVOICE #:".

    Note: 

    As advanced feature, We added ability to also say it is relative to (Text equals to, Text starts with, Text ends with, Text contains, Text matches regex).

    In Babelway, we're using the standard Java version of REGEX, and it's the same used all over the system.

    3- Within a table

    This will extract the line values from the table and the table can either be displayed in a single page or is divided on multiple pages.

    The below steps will describe how to use the "Fixed" extraction method.

    A-For extracting one line you will click on it to select it, For extracting more than one line you will click and drag the mouse around the text you want to extract, as shown below.

    

    B-From the pop-up window "How to find field value?" click on "Fixed", as shown below.

    

    C-Now the "Extract data from field" will show the field name which in this case it is "field1" and the value "6, Rue Louis de Geer 1348 L", as shown below.

    

    D-We can rename the field by clicking on it and then rename it, as shown below.

    

    

    Note: After you finish click on the "Confirm" button to save this changes.

    E-Now the "Field name" and the "Field value" will be extracted, as shown below.

    

    The below steps will describe how to use the "Relative to a label / image" extraction method.

    A-Click on the field then the "How to find this field value?" pop-up will be displayed, as shown below.

    

    B-Select the "Relative to a label / image", as shown below.

    

    C-Then select the relative label in this case it is "INVOICE #:", as shown below.

    

    D-In this case the PDF has two "INVOICE #:" so we will need to select a strategy for it, as shown below.

    

    E-From the "Strategy when we find multiple labels or images :" select in this case "Pick first", as shown below.

    

    Note:

    Pick first: This strategy means we will always pick the first key encountered on the PDF.

    Pick last: This strategy means we will always pick the last key encountered on the PDF.

    Surrounding field: Choose a label/image that is close to the key you want to pick.

    F- Now the "Extract data from field" will show the field name which in this case it is "field2" and the value "101", as shown below.

    

    G- We can rename the field by clicking on it and then rename it, as shown below.

    H- Now the "Field name" and the "Field value" will be extracted, as shown below.

    

    The below steps will describe how to use the "Within a table" extraction method.

    A-Click on the field then the "How to find this field value?" pop-up will be displayed, as shown below.

    

    B-Select the "Within a table", as shown below.

    

    C-Select the start of the table, as shown below.

    

    D-From the "How to find the start of the table?" pop-up window select "Relative to a label/image" then in this case select "Quantity", as shown below.

    

    

    

    E-Select the end of the table, as shown below.

    

    F-From the "How to find the start of the table?" pop-up window select "Relative to a label/image" then in this case select "Subtotal", as shown below.


    

    

    I-Select the end of the table on the first page, as shown below.

    

    J-From the "How to find the start of the table?" pop-up window select "Fixed position", as shown below.

    

    

    K-Select the Item that will inform the system that will determine the line delimiter, as shown below.

    

    L-From the "What is the alignment of this field?" pop-up window select "Align Left", as shown below.

    

    

    M-Select all of the items you want to extract them from the table, as shown below.

    

    N-Now you will find four fields created in this example from "Item1" to "Item4"m as shown below.

    

    O-Now rename the fields to be clearer for the mapping, as shown below.

    

    

    P-For the Table name change its name to be "Lines" for example, as shown below.

    

    Q-Now when we open the "Message In" we will see the structure is created, as shown below.

    

    The following properties are available:

    • Message Definition: This file is Babelway's internal representation of your message definition tree.
    • Validation Mode: The validation mode describes how strictly messages need to comply with your definition in order to be processed.
    • Template name: Babelway allows you to define multiple templates that will match the same message definition. Please choose the name of the first template you will create.
    • Trigger based on message definition validation errors:  If you check this, whenever some extracted fields will cause validation errors, you'll be notified by e-mail and able to fix the message.
    • Recipients: List of emails where the error notification is sent.
    • Split texts when double space: This will split texts in two when a double space is detected.
    • Add missing space characters:  Sometimes, PDFs contains texts that are separated by position only and don't contain the actual space ' ' character. This will add those space character.
    • Missing space tolerance: Number from 0.01 to 2.00. This is the percentage of a space width that the difference between two letters must not exceed to generate a space character. For example, 0.7 means : we create a space between A and B if posX(A) spaceWidth - posX(B) less than spaceWidth * 0.7. The actual space width can vary a lot from PDF to PDF. This a magical number to find.
    • Merge characters tolerance: Number from 0.01 to 2.00. This is a percentage of space width that is needed to consider two characters to be split. For example, 1.00 means we look for maximum 1.00 * spaceWidth after character A to find the next character. If we find it, we merge, otherwise, we finish the text extraction here.

    PDF based on XHTML template Message Format

    PDF Wizard screen allows you to define your PDF message format based on your XHTML template file.

    To define a message in PDF format, select an existing template or make a copy of the generic PDF template in the catalogue and the following screen will be displayed.

    Wizard screen

    When you create a new message format, you must first configure it using the following wizard.

    

    PDF Wizard Screen

    A PDF message can only be set up using a template file in XHTML format. Select your template file using the Choose File button next to the XHTML file, then click on the Confirm command. 

    File sample

    Below is a sample PDF file.

    PDF output example


    Date : 25-08-2009

    Example
    Invoice number : field1 Contact Name : field2 field3

    Some static info
    Description Unit price Qty Vat rate Tax free price Tax Total price
    Support pack 5h 425.00 1 21.00 425.00 89.25 514.25

    second page
    You can upload images or css sheets as file properties and use a simple relative url in your xhtml.

    For specific print css options, see http://www.w3schools.com/css/css_reference.asp for all css options

    Barcode Integration


    123456789012345675
    123456789012345675
    123456789012345675
    01234133
    A123456789A
    123456789012345675
    123456789012345675
    123456789012345675
    123456789012345675
    123456789012345675
    123456789012345675
    123456789012345675

    

    Edit screen

    Once the message format template has been uploaded, or when it is used or copied from a saved format, you have the possibility to go on the created element. If you want to edit the properties of that message definition, switch to "Properties".

    

    PDF Edit screen

    The following properties are available:

    • Xhtml template: The Xhtml template which defines structure of the requested PDF.
    • Xhtml resources: Resources used inside the Xhtml template such as images, css files.
    • Sample: An example of PDF file handled by this message definition.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.
    • Fix validation errors: If you check this, whenever some extracted fields will cause validation errors, you'll be notified by e-mail and able to fix the message.
    • Recipients: List of emails where the error notification is sent.

    In order to ease the navigation, the xhtml attribute id is used as the name in the resulting message definition. These elements are visible by default. Mapping to these elements will be preserved if you upload another template containing the element with the same id. The attribute id needs to be using valid xml syntax (e.g.: spaces are not allowed).

    If you need to add a loop to your xhtml, you can simply name the element with a suffix -loop like in the example above. The system will create a loop and a corresponding element. Mapping to these elements will also be preserved if you upload another template.

    All elements without id in the xhtml will be hidden by default. If you cannot add an id to your element, you have to manually show any element you need in the transformation step. Additionally, you should edit and rename the element label for easier management during transformation step.

    To ease the search of the fields you need, the values uploaded from your example file are displayed in the field tooltip descriptions.

    See Message Definition to change show/hide settings and edit the element label.

    Note: If you need to add a barcode corresponding to a specific EAN, you can use the below structure after the EAN field in your template.

    "" 

    Multirecord Flat files

    Multirecord Wizard screen allows you to define your Multirecord message format (delimited or a fixed-length) according to your own file format.

    What is an mr file?

    An mr file is a multirecord definition file used by the Self-Service MultiRecord wizard to generate the corresponding message definition and also build the corresponding serving xml resource file.

    How to build an mr file?

    (1) Specify if the message is a delimited or a fixed-length message:

    For fixed-length messages, the mr file header looks like this:

    For delimited messages the mr file header looks like this:

    * recordDelimiter defines the delimiter between each record, it is usually the ending line character represented on windows by \r\n, on Unix/Linux by \n and on Macintosh by \r.

    Note: It is recommended when creating Multirecord for the "Message In" to remove the LineDelimited in order to support all EOL "End Of Line" for any of those operating systems.

    * lineDelimited specifies if the system uses a record delimiter. If set to false, the record will be based on the sum of the fields length for fixed length or the number of fields for delimited multirecords.

    * trim specifies if the white spaces at the beginning and the end of the fields should be removed.

    * fieldDelimiter is only used with a delimited message, defines the field delimiter.

    * quoteSymbol-character is the character used to quote a field (often ")

    * quoteSymbol-escapeSequence is the sequence that displays the quote symbol character in a quoted field (often \")

    Tip:

    For multirecord as Message In, do not specify recordDelimiter; the system will catch the \r or \n or \r\n. For multirecord as Message Out, DO specify recordDelimiter as being for instance "\r\n"; this will generate windows compliant file and let you change the delimiter from the advanced properties later on. 

    (2) Write the message records definitions:

    You should specify the name for the record and for each of its fields. Each record should have at least one field with a static value which is used to identify the record.

    * the width is only mandatory for fixed-length messages

    * value is used to specify a static value of the field that never changes.

    By default all first fields with a static value are used to identify a record. But, you can also manually define which fields must be used to identify a record using the identifier parameter.

    Note: The identifier is case sensitive, so identifier="true" is not equal to identifier="True".

    In this case, only the third and fifth fields (fieldB & fieldD), with identifier equals to "true", is used to identify the record. The default (without identifier="true") is only using recordType field as the identifier. 

    Remark:

    For fixed-length messages, the fields used to identify a record should have the same position and length in each record. No overlap between identifiers is allowed between records, If there is only one field used to define the records, it should have the same position and can have a different length in each record.

    If fixed-length messages have variable length identifiers per record, the only way to define it in the mr files is to first define the smallest common length identifier for all records and then for each record that has a longer identifier, add as many smaller fields as needed to unambiguously identify each record.

    Note: if the multi-record file has a leading spaces, it must be taken into account while defining the mr file and make sure that the identifiers are at the same position, so you can remove the leading spaces by using the "Replacement based on regular-expressions" Extra Processing and add the following regex (?m)^[\s]  to match all the leading spaces and replace them with empty values as shown below:

    

    Regular expression to remove the leading spaces

    Note: In Babelway, we're using the standard Java version of REGEX, and it's the same used all over the system.

    AAAAA  contentcontent  anothercontent
    	1112222  this and that

    The following definition is not valid since the fieldA is bigger than field1 and moreover, fieldA also overlaps with field2 and only the first record will be read:

    <Fig>

    It should be replaced by using the "Replacement based on regular-expressions" Extra Processing as indicated before:

    <Fig>

    We had to split fieldA in two in order to have one fieldA 3 characters long (the same as field1) and another fieldA with the 2 remaining characters.

    Then field2 (length 4) was also bigger than the second fieldA (length 2) so we also need to split it in two field2 of 2-character length.

    All corresponding identifiers now have the same length (3 and 2) and there is no overlap between them.  

    It is also possible to add 4 extra settings (label, description, justify & padCharacters) to each field:

    <Fig>

    * label and description are used to display the message tree.

    * justify can be center, left or right.

    * padCharacter is the character used to fill an empty space in the field width.

    (3) Define the message structure at the end of the mr file:

    <Fig>

    *Each element can define the minOccurs and the maxOccurs setting with either 0, a positive number or 'unbounded'.

    * Records defined in the records simplesect can only appear once in the message structure.

    * Records can be grouped using the group element. The name of the group is mandatory.

    * Records in a group should be ordered in the same way they appeared in the message. 

    Sample of a multirecord fixed-length message:

    HH00123  AB
    HH00045 CDE
    R1one  100
    R1two  101
    R1four 103
    FF3

    Sample of a multirecord definition file:

    <Fig>

    Note: When updating the MultiRecord structure, you must update it from the "MultiRecord definition" file first (not from the message tree) and then by using the "Rerun creation wizard" button, upload the updated "MultiRecord definition" file from the "Message In" or "Message Out".

    The following properties are available:

    • Output Charset: Output charset is used to encode the file.
    • Input Charset: Input Charset is used to decode the file.
    • MultiRecord definition: The MultiRecord definition file.
    • ServingXml (Visible only for Babelway admins): The ServingXml code generated based on the Multirecord defintion file.
    • Sample: An example of Multirecord file handled by this message definition.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings.

    Serving Xml

    File sample

    Below is a sample of Serving Xml file:

    <Fig>

    Belgium
    	
    	
    France
    	
    	
    Italy

    The following properties are available:

    • Output Charset: Output Charset is used to encode the file.
    • Input Charset: Charset to use to decode the file
    • XSD: Xsd definition file corresponding to the XML message.
    • ServingXml: The ServingXml code file.
    • Sample: An example of FLATFILE handled by this message definition.
    • Filename: The filename of the output message [with extension if applicable]. When empty, we apply the default settings

    TRADACOM Message Format

    TRADACOM is an early standard for EDI (Electronic Data Interchange) primarily used in the UK retail sector. It was introduced in 1982 as an implementation of the UN/GTDI syntax, one of the precursors of EDIFACT, and was maintained and extended by the UK Article Numbering Association (now called GS1 UK).

    As Babelway supports all TRADACOM transaction sets of the TRADACOM standard, you can use any of them in your own gateway setup.

    Babelway supports all following TRADACOM documents:

    1.ACKHDR, ACKMNT, ACKTLR, AVLDET, AVLHDR, AVLTLR, CORDER, CORHDR, CORTLR, CRAHDR, CRAINF, CRATLR, CREDIT, CREHDR, CRETLR, CUSHDR, CUSINF, CUSTLR, DELHDR, DELIVR, DELTLR, DLCDET, DLCHDR, DLCTLR, DRAHDR, DRAINF, DRATLR, EXCHDR, EXCINF, EXCTLR, GENHDR, GENRAL, GENTLR, INVFIL, INVOIC, INVTLR, LPRDET, LPRHDR, LPRTLR, ORDERS, ORDHDR, ORDTLR, PAYHDR, PAYINF, PAYTLR, PICHDR, PICKER, PICTLR, PPRDET, PPRHDR, PPRTLR, PRIHDR, PRIINF, PRITLR, PROHDR, PROINF, PROINF, PROTLR, RSGRSG, SADDET, SADHDR, SADTLR, SNPHDR, SNPHDR, SNPSTS, SNPTLR, SRMHDR, SRMINF, SRMTLR, UCNDET, UCNHDR, UCNTLR, UCNTLR, UPLHDR, UPLIFT, UPLTLR, UTLBIL, UTLHDR, UTLTLR, UVATLR, VATTLR

    File sampleBelow is a sample of TRADACOM invoice file

    STX=ANAA:1 501xxxxxxxxxx:name 501xxxxxxxxxx:NAME SERVICES (U.K.)LTD. 040316:184411 00001  INVTES'
    MHD=1 INVFIL:9'
    TYP=0700 INVOICES'
    SDT=501xxxxxxxxxx:053752CF01STDD Tenprl Fnsrjnl Sbbqfreivpr 221 UvyyunyyRoad:Yvfohea:Co. Antrim:N.Ireland:OG27 5WQ 412557175'
    CDT=501xxxxxxxxx NAMESERVICES (U.K.) LTD. Cnexynaqf Pbheg:OvezvatunzTerng Cnex:Ehorel:Birmingham:OG45 9CM'
    FIL=1 1 040316'
    FDT=040302 040302'
    MTR=7'
    MHD=2 INVOIC:9'
    CLO=0000000100007:   PNEEVPX GOLF CLUB:ABEGU ROAD:PNEEVPX SRETHF::OG388YC'
    IRF=01000589M 040302 040302'
    ODD=1 ::040302 :040302'
    ILD=1 1 :8408  :31266 0 2:2500:KG 54300 135800 Z 0   SILVERSIDE 1-5 KG'
    STL=1 Z 0 0 1358     1358  0 0  1358'
    TLR=1 1358     1358  1358 0  1358'
    MTR=8'
    MHD=3 VATTLR:9'
    VRS=1 Z 0 1358 1358 0 1358 1358'
    MTR=3'
    MHD=4 INVTLR:9'
    TOT=1358 1358 0 1358 1358 1'
    MTR=3'
    MHD=5 RSGRSG:2'
    RSG=00001 501xxxxxxxxxx'
    MTR=3'
    END=5'

    The following properties are available:

    • Output Charset: Charset used to encode/decode the file.
    • Input Charset:  Charset used to encode/decode the file.
    • Sample: An example of TRADACOM file handled by this message definition.
    • Filename:  The filename of the output message [with extension if applicable]. When empty, we apply the default settings.


    0 people found this helpful.

    Related Articles