For some of the more common EDI formats (CSV, XLS, XLSX and XML) the user is able to tell cargooffice how to parse an EDI file. Below is a description of this program. It can be found here:
Backoffice -> Shipments -> EDI Configurator
A note on spreadsheet files : If these are Microsoft spreadsheets containing formulas then the results might be unpredictable do to Microsofts proprietary formats of the fomulas. You have to test these files thoroughly before entering production or use an open standard.
This is an example of a configuration screen, an explanation follows.
Click add new mapping if you want to enter a new configuration. The system will ask you for a customer number, each time this customer sends and EDI file, this new configuration is used to import the data.
Alternatively you can choose an existing customer to make changes to it's configuration.
There are three sections where you can map cargooffice fields to input data; the order, shipment and goods section. Generally an order in cargooffice has one or more shipments, and a shipment may have one or more goods (lines).
To add a field, choose the relevant cargooffice fieldname from the list and click Add this field:
Use parameter goodsFieldNames, shipFieldNames or orderFieldNames if you want to add a not listed field.
The value column may contain a literal, a fixed value that will allways be loaded into the selected cargooffice field. In the example screen at the top of this page the literal 13160810 is loaded into field customerID. And the literal Imailo is loaded into field orderName.
By using @ you can reference columns in a spreadsheet (.xls files) and also columns in a csv file. In latter case (a csv file) @A means the first column, @B the second column etc.
The value column may contain a reference to a field. The field must be defined earlier in the configuration and its name must be between curly brackets. Example:
Note: in this example orderReference must be defined earlier in the configuration (upstream).
Note: referencing a field can not be combined with concatenate function
By using / you can reference tags in an xml file. The reference is an xpath like reference where you need to specify both the group tag name as well as the tag name itself. For example /order/orderEmail references the tag <orderEmail> within the group tag <order>. There is no need to reference any higher levels in the xml, the system only needs the group tag names for the order, shipment and goods (lines).
For an example XML have a look at: LPtransXml
Note1: You have to specify any lower levels in xpath definitions. If for example you want to reference <packingType> in the following xml, you will use: /goodsLine/packingDetails/packingType.
<exampleXml> <order> .. <shipment> .. <goodsLine> <packingDetails> <packingType>container</packingType> <packingSize>20ft</packingSize> </packingDetails> </goodsLine> ..
Note2: The xpath definition always starts with the repeating group tag, in this example /goodsLine/ because this tag repeats itself within a shipment. In the same fashion references to shipment tags begin with /shipment/ and references to order tags begin with /order/. So always the repeating group tag first, and no higher levels.
Note3: To help the system finding the order-shipment-goodsLine hierarchy, please enter some fieldNames (tags) from each hierarchy into the params orderFieldnames, shipmentFieldNames and goodsFieldnames.
WARNING:If not one tag of the XML can be found in these params then the file might not be processed.
Note4: It is possible to use regular expressions in the xpath definitions. This might be useful if you need an xml tag with a specific attribute. If for example you need the vessel name from the xml below, you might use the following definition:
<exampleXml> <order> .. <shipment> <vesselDetails> <ident type="vesselType">bulk carrier</ident> <ident type="vesselName">Joyride</ident> <ident type="vesselLength">130</ident> </vesselDetails> ..
Note5: An easier method of getting an attribute is using the '@' character:
Note6: The system uses a subset of the xpath syntax. You can use the "real" xpath syntax if you need more complex definitions. In this case you must begin the definition with a double slash (//),
Some examples:
Remark1: For more information and examples see: this page
Remark2: You can test your xpath definitions: here
Remark3: If your "real" xpath doesn't work, then try to define the complete path, so with all higher levels.
Trick: x-paths are only recognised if the first character in the 'value' field is '/'. It is not possible to concatenate an x-path with a leading text like 'Location:& &//consignment/location[qualifier="OS"]/address'.
What you can do to circumvent this is use a non-existing x-path as your first x-path. Like '//consigment/loc&Location:& &//consignment/location[qualifier="OS"]/address'.
You will trick the configurator into recognising the x-path, the first x-path will evaluate to nothing and effectively the result will have your leading text. Neat, huh?
Remark4: You can use ../ ("real" xpath only!) to go to a higher level of your xml file BUT you can only go as high as the highest level you have used in the configuration. For example:
<exampleXml> <order> <orderReference>123</reference> <shipment> <vesselDetails> <ident type="vesselType">bulk carrier</ident> <ident type="vesselName">Joyride</ident> <ident type="vesselLength">130</ident> </vesselDetails> </shipment> <shipment> .... <shipment>
if you want to reach the orderReference, you could use //vesselDetails/../../orderReference but you can only do so if your starting point in the configuration was //order or higher.
Warning: Using the "real" xpath syntax might be slower than using the default subset.
Notation: @{column}:substr(int $start [, int $length ])
Substr takes a specific part of a value, defined by the start en length parameters. If start is positive, the resulting value is the part starting from this position to the end of the value, counting from zero. For example in string 'abcdef', the character at position 0 is 'a' and the character at position 2 is 'c', etc.
Substr examples:
Where column @A has a value of '1234':
Where column @A has a value of '1234':
By using & multiple references can be concatenated into one cargooffice field. Like these examples:
customerID : If column B has the value `1234` then the resulting value in field customerID will be `customer1234`
orderReference : If column I has a value 'ref' and J 'abc' then the resulting value in field orderRefenece will be 'ref abc'.
Notation: @{column}:split(string $separation, int $position)
This function splits a value into 1 or more parts where parameter $separation defines the character or string on which the value is split and parameter $position defines which part should be taken.
Examples:
Where column @A has a value of `10:00 12:00`:
In general dates must be defined in the format YYYY-MM-DD, or (in spreadsheets) defined as a date formatted column.
The special function today takes the current date plus a number of days. Example:
![]() |
![]() |
![]() |
Also (less common) you can use deliveryDate-n. In this case the deliveryDate is used minus an optional number of days. For example:
![]() |
![]() |
Please note:
You can do simple arithmetic by starting a column reference with a plus (+) sign. Example:
![]() |
Examples:
NOTE: You cannot combine arithmetic with xml paths. There is a way around this. The xml is converted to a csv which can be viewed when you use the 'test' button on the bottom right of the configurator screen. You can then use the columns of this csv for calculations. If you place new variables/fields above this column reference, you will need to check and re-define the column reference.
This may look like this:
The translate column is used to translate values into other values or for some special functions (described below).
Translate values are separated by commas and the original value (the first value) is separated by the target value by =. Example:
![]() |
NOTE: You can add a default value by using an asterisk character
(*)
. For example *=000, will translate unknown values into 000.
![]() |
![]() |
note: The examples above can be combined. So any combination of translations with quotes, without quotes and regular expressions may me used in the same translation line.
Sometimes a CSV or XLS file contains multiple columns for quantity.
Example:
A | B | C | D | E | F | G |
orderID | From | To | Pallets | Boxes | Colli | Crates |
---|---|---|---|---|---|---|
12345 | London | Paris | 2 | |||
12346 | Brimingham | Southampton | 4 | |||
12347 | Glasgow | Amsterdam | 1 | 3 |
To define this you can use the -or- character | (a vertical bar) between the column definitions.
Example:
![]() |
NOTE If the packing name is in a column you can also use a column definition here. For example:
@D?=@H,@E?=@I,@F?=@J,@G?=@K
The function param: retrieves the translate values from a parameter. Example:
![]() |
![]() |
The preg_match function is an alternative method to take specific part from a value. It is meant for more experienced users, for example programmers who know what regular expressions are, more specific perl compatible regular expressions
.
preg_match matches the value with a certain regular expression and picks out the part defined between parentheses.
The preg_match must be entered into the translate column, for example:
![]() |
The preg_replace function is an alternative method to do translations. It is meant for more experienced users, for example programmers who know what regular expressions are, more specific perl compatible regular expressions
.
preg_replace matches parts of a value with a certain regular expression and replaces those parts by a second value.
The preg_replace must be entered into the translate column, for example:
![]() |
preg_replace/(\d{2})(\d{2})(\d{2})(\d{2})/$1-$2-$4/
This function will translate 10102012 into 10-10-12 using backreferences.
The function toFloat translates a string into a floating point number.
Example:
![]() |
The function min takes a minimum value. If the column value is less than the given min value then the min value is taken.
Example:
![]() |
The function ceil rounds fractions up to the next whole (integer) number.
Example:
![]() |
The function condition compares two values and depending on the result takes either the true-value or the false-value.
Example:
![]() |
The column that should be evaluated must be in the 'value' (waarde) field, in this example : @G.
Other examples:
NOTE : Instead of a column definition (e.g. @A) it is also possible to use a field name, like: {customerID}. The field name must be between curly brackets and defined earlier in the configuration. Example:
Sometimes our programmers create special translation functions for specific clients.
These functions can be called by their name followed by an optional number of parameters.
The programmer will tell you the exact name of the function.
Example:
![]() |
NOTE1 : In stead of a column definition (e.g. @A) it is also possible to use a field name here, like: {customerID}. The field name must be between curly brackets and defined earlier in the configuration. See also the note on field names in the description above at Function: condition.
NOTE2 : In stead of a column definition (e.g. @A) it is also possible to use a literal, like : Kilo or 69. Any literals should not be defined between quotes.
Please contact our development department if you need special functions.
Depending on the file set-up there is an option to filter certain record-lines out of your file.
![]() |
Special field orderID needs some extra explanation.
![]() |
-- HenkRoelofs - 2012-02-24
I | Attachment | History | Action | Size | Date | Who![]() |
Comment |
---|---|---|---|---|---|---|---|
![]() |
xml-csv-arithmetic.png | r1 | manage | 40.3 K | 2020-07-07 - 17:42 | WiljoVanLenthe | |
![]() |
csvXls.png | r1 | manage | 39.9 K | 2012-02-24 - 13:13 | UnknownUser | Example screen |
![]() |
csvXls2.png | r1 | manage | 35.3 K | 2017-12-12 - 11:07 | UnknownUser | Example screen |
![]() |
csvXlsAddMapping.png | r1 | manage | 4.4 K | 2012-02-24 - 13:56 | UnknownUser | add thsi field |
![]() |
csvXlsArith1.png | r1 | manage | 1.1 K | 2013-01-14 - 15:56 | UnknownUser | artimetic |
![]() |
csvXlsCalcDeliveryDate.png | r1 | manage | 2.5 K | 2017-12-22 - 13:20 | UnknownUser | |
![]() |
csvXlsColumnRef.png | r1 | manage | 0.9 K | 2012-02-24 - 17:08 | UnknownUser | xls column reference |
![]() |
csvXlsConcat.png | r1 | manage | 2.2 K | 2012-02-27 - 16:50 | UnknownUser | concatenate |
![]() |
csvXlsFieldRef.png | r1 | manage | 1.2 K | 2019-04-02 - 13:55 | UnknownUser | field reference |
![]() |
csvXlsGeneralSettings.png | r9 r8 r7 r6 r5 | manage | 17.4 K | 2020-03-12 - 12:42 | UnknownUser | general settings |
![]() |
csvXlsMulti.png | r1 | manage | 2.2 K | 2017-11-14 - 10:21 | UnknownUser | multi column definition |
![]() |
csvXlsNewCust.png | r2 r1 | manage | 3.1 K | 2012-02-24 - 13:40 | UnknownUser | newmapping |
![]() |
csvXlsPregMatch.png | r1 | manage | 2.1 K | 2012-02-27 - 17:38 | UnknownUser | preg_match |
![]() |
csvXlsPregReplace.png | r1 | manage | 1.5 K | 2012-02-27 - 17:51 | UnknownUser | preg_replace |
![]() |
csvXlsToFloat.png | r1 | manage | 1.5 K | 2012-02-28 - 16:52 | UnknownUser | toFloat |
![]() |
csvXlsToday.png | r2 r1 | manage | 1.8 K | 2015-03-27 - 16:06 | UnknownUser | today function |
![]() |
csvXlsToday2.png | r2 r1 | manage | 1.9 K | 2015-03-27 - 16:10 | UnknownUser | |
![]() |
csvXlsToday3.png | r2 r1 | manage | 1.9 K | 2015-03-27 - 16:11 | UnknownUser | |
![]() |
csvXlsToday4.png | r1 | manage | 2.2 K | 2015-03-27 - 16:25 | UnknownUser | |
![]() |
csvXlsToday5.png | r1 | manage | 4.2 K | 2016-03-02 - 13:08 | UnknownUser | |
![]() |
csvXlsTranslate.png | r1 | manage | 1.9 K | 2012-02-27 - 18:29 | UnknownUser | translate column |
![]() |
csvXlsTranslate3.png | r1 | manage | 3.5 K | 2014-01-31 - 16:49 | UnknownUser | |
![]() |
csvXlsTranslate4.png | r3 r2 r1 | manage | 2.5 K | 2014-12-19 - 13:37 | UnknownUser | |
![]() |
csvXlsTranslate5.png | r1 | manage | 12.8 K | 2014-12-19 - 13:46 | UnknownUser | |
![]() |
csvXlsXmlRef.png | r1 | manage | 0.9 K | 2012-02-24 - 19:06 | UnknownUser | xml tag reference |
![]() |
csvXlsXmlRef2.png | r1 | manage | 1.1 K | 2014-04-04 - 12:25 | UnknownUser | xml tag + regex |
![]() |
csvXlsXmlRef3.png | r1 | manage | 4.0 K | 2014-11-19 - 16:11 | UnknownUser | xml attribute |
![]() |
csvXlsceil.png | r1 | manage | 1.0 K | 2012-02-28 - 17:00 | UnknownUser | ceil function |
![]() |
csvXlscondition.png | r1 | manage | 1.2 K | 2012-02-28 - 17:12 | UnknownUser | condition function |
![]() |
csvXlsmin.png | r1 | manage | 1.3 K | 2012-02-28 - 16:56 | UnknownUser | min function |
![]() |
csvXlsTranslate2.png | r1 | manage | 5.7 K | 2012-06-04 - 09:10 | RutgerRutgers | translateQuotes |