Kourier Integrator Online Help
You can specify one or more Import Specifications (XML to U2 Import Specification or File to U2 Import Specification) when using a Kourier Services. Each Import Specification is processed in the order that it is specified in the Command section of the Service. All Import Specifications declared in a Service must be of the same type (i.e., XML to U2 or File to U2).
The first line in the Command field on the Service page must be KMK.IMPORT when processing Import Specifications.
All XML messages processed by a service must have the same XML-ROOT-TAG and XML-TRANS-TAG. If the XML-ROOT-TAG is not found in a message, a FATAL error is raised and all processing stops.
For each message processed by the service, the XML-TRANS-TAG is used to parse the message into one or more transactions. If the XML-TRANS-TAG is not found in a message the message is skipped.
For each transaction within a message, each Import Specification is processed to determine if the Record Tag specified in the Import Specification matches an element in the transaction. If the Import Specification has also specified an Attribute and Attribute Value then the Record Tag element must have the attribute and attribute value specified in the Import Specification to be considered a match.
If there is a match, each transaction is broken down to into one or more records based upon the value of the Record Tag specified in the Import Specification.
Consider the following XML document:
<ADDRBOOK> <ENTRY ID="id1"> <NAME> Name One</NAME> <ADDRESS>101 Some Way</ADDRESS> <PHONENUM DESC="Work1">303-111-1111</PHONENUM> <PHONENUM DESC="Fax1">303-111-2222</PHONENUM> <PHONENUM DESC="Pager1">303-111-3333</PHONENUM> <EMAIL>name.one@some.com</EMAIL> </ENTRY> ENTRY ID="id2"> <NAME>Name Two</NAME> <ADDRESS>202 Some Way</ADDRESS> <PHONENUM DESC="Work2">>303-222-1111</PHONENUM> <PHONENUM DESC="Fax2">303-222-2222</PHONENUM> <PHONENUM DESC="Home2">303-222-3333</PHONENUM> </ENTRY> <ENTRY ID="id3"> <NAME>Name Three</NAME> <ADDRESS>203 Some Way</ADDRESS> <PHONENUM DESC="Work3">303-333-1111</PHONENUM> <PHONENUM DESC="Fax3">303-333-2222</PHONENUM> <PHONENUM DESC="Home3">303-333-3333</PHONENUM> <EMAIL>name.three@some.com</EMAIL> </ENTRY> </ADDRBOOK>
Using the XML document shown above, if a transaction tag of “/” (meaning no transaction tag) was specified in the Import Service and a Record Tag of “ENTRY” was specified in the Import Specification, Kourier would process the Import Specification 3 times for this transaction because there are 3 occurrences of the Record Tag (ENTRY) in the XML document. Each call would have access to the following information.
Call 1
<ENTRY ID =""id1"> <NAME> Name One </NAME"> <ADDRESS> 101 Some Way </ADDRESS"> <PHONENUM DESC="Work1""> 303-111-1111 </PHONENUM"> <PHONENUM DESC="Fax1 ""> 303-111-2222 </PHONENUM"> <PHONENUM DESC="Pager1 ""> 303-111-3333 </PHONENUM"> <EMAIL"> name.one@some.com </EMAIL"> </ENTRY>
Call 2
<ENTRY ID="id2"> <NAME> Name Two </NAME> <ADDRESS> 202 Some Way </ADDRESS> <PHONENUM DESC =" Work2 ""> 303-222-1111 </PHONENUM> <PHONENUM DESC =" Fax2 ""> 303-222-2222 </PHONENUM> <PHONENUM DESC =" Home2 ""> 303-222-3333 </PHONENUM> </ENTRY>
Call 3
<ENTRY ID="id3"> <NAME> Name Three </NAME"> <ADDRESS> 203 Some Way </ADDRESS"> <PHONENUM DESC ="Work3""> 303-333-1111 </PHONENUM"> <PHONENUM DESC ="Fax3""> 303-333-2222 </PHONENUM"> <PHONENUM DESC ="Home3""> 303-333-3333 </PHONENUM"> <EMAIL> name.three@some.com</EMAIL"> </ENTRY>
Once the processing for an Import Specification is complete, the same transaction would be processed thru the remaining Import Specifications declared in the Import Service.
When processing a File to U2 message, the name of the source file associated with the message is compared to the Source File Mask specified in each Import Specification. If the file name matches then the Import Specification is executed.
The transaction key or keys specified in the Import Specification are used to segment the flat-file into one or more transactions. Note that for a flat-file, the concept of a transaction and record are one in the same.
Consider the following flat-file:
Order
Date
B2Cust
Line
Part
Qty
Price
1000
12/3/2013
2001
1
101-00
10
0.25
1000
12/3/2013
2001
2
102-00
20
0.5
1000
12/3/2013
2001
3
103-00
30
0.75
1001
12/3/2013
2012
1
101-00
10
1
1001
12/3/2013
2012
2
102-00
20
1.25
If the Import Specification designated the Order column as a Transaction Key then Kourier would process the Import Specification 2 times for this transaction because there are 2 sets of rows that have the same transaction key. Each call would have access to the following information.
Call 1
Order
Date
B2Cust
Line
Part
Qty
Price
1000
12/3/2013
2001
1
101-00
10
0.25
1000
12/3/2013
2001
2
102-00
20
0.5
1000
12/3/2013
2001
3
103-00
30
0.75
Call 2
Order
Date
B2Cust
Line
Part
Qty
Price
1001
12/3/2013
2012
1
101-00
10
1
1001
12/3/2013
2012
2
102-00
20
1.25
Once the processing for an Import Specification is complete, the same message would be processed thru the remaining Import Specifications declared in the Import Service.