lumnik. / scenarios All scenarios · Français

The order lines of a flat EDI file read at their place

Goal Read the order lines of a fixed-width EDI file as columns, with no mapping tool.

A manufacturer and its logistics provider exchange flat files. No separator: each field has its place and its width.

ZINT_CC_42100001.txt
SAPPRD           NPEC      
SAPPRD           NPEC      EC100001  M. DURAND                               12 RUE DES LILAS                                  69003   FR 42100001    KIT0012     Couverture à barres automatique 8x4 coul30.000    M2  6880001   
SAPPRD           NPEC      EC100001  M. DURAND                               12 RUE DES LILAS                                  69003   FR 42100001    KIT0031     Kit anti-soulèvement sur tube pour couve1.000     U   6880002   
SAPPRD           NPEC      EC100001  M. DURAND                               12 RUE DES LILAS                                  69003   FR 42100001    LIV0000     Livraison couverture à barres France mét1.000     U   6880003   
SAPPRD           NPEC      EC100245  MME FAURE                               LIEU-DIT LES ÉPINETTES - 4 CHEMIN DU MOULIN       84120   FR 42100002    BAC0450     Bâche hiver opaque 10x5                 50.000    M2  6880011   
SAPPRD           NPEC      EC100245  MME FAURE                               LIEU-DIT LES ÉPINETTES - 4 CHEMIN DU MOULIN       84120   FR 42100002    ENR0002     Enrouleur télescopique                  2.000     U   6880012   
SAPPRD           NPEC      EC100245  MME FAURE                               LIEU-DIT LES ÉPINETTES - 4 CHEMIN DU MOULIN       84120   FR 42100002    LIV0000     Livraison bâche France métropole        1.000     U   6880013   
manifests/20-order-line.yaml
kind: Entityname: order_line_blabel: Ligne de commande à livrerdescription: "An order line the ERP sent the logistics partner: customer, delivery address, article, quantity and unit."match: [line_id]scopes: [logistics-b]columns:  line_id: { label: "Ligne" }  order_no: { label: "Commande" }  customer: { label: "Client" }  customer_name: { label: "Nom" }  address: { label: "Adresse de livraison" }  postcode: { label: "Code postal" }  article: { label: "Article" }  label: { label: "Libellé (40)" }  quantity: { label: "Quantité" }  unit: { label: "Unité" }sources:  - table: t_scenario_edi_cc_b    map: { line_id: line_id, order_no: order_no, customer: customer, customer_name: customer_name, address: address,           postcode: postcode, article: article, label: label, quantity: quantity, unit: unit }
ZINT_CC_42100003.txt
SAPPRD           NPEC      
SAPPRD           NPEC      EC100377  M. NGUYEN                               3 IMPASSE DES CHENES                              13100   FR 42100003    ENR0002     Enrouleur télescopique                  1.000     U   6880021   

Limits

  • The widths are the file's: if the ERP changes its layout, the expression changes with it.
  • A label the ERP cut stays cut: lumnik does not recover what was not sent.
  • Synthetic files, on the template of a real exchange.

Logistics · flat EDI

Orders arrive as a flat file.

One line per item, each field at its place.

ISO-8859-1, fixed width

The problem

No separator.

  • A field is a position and a width.
  • A mapping tool is costly.

What is not changed

The ERP writes as before.

  • The same file, the same folder.
  • No format to negotiate.

The trap

Accents in a tiny file.

  • One line, one é.
  • Too little to guess the encoding.

What had to be written

lines: true

One line.

  • One file line, one table row.
  • The fields cut at their place.
  • A 47-line scenario, two manifests.

The result

Six order lines as columns.

  • Customer, order, article, quantity.
  • « Couverture à barres », accent included.

The limit

The widths are the file's.

  • If the ERP changes its layout, the manifest changes with it.

Try it

The scenario replays locally.

Every step is published with its output.

This scenario runs on lumnik Open, free and open source.

Try lumnik Open →