Skip to content

Instantly share code, notes, and snippets.

@mikeacjones
Last active January 6, 2021 16:39
Show Gist options
  • Save mikeacjones/0c25d6b339e863e7df23c417135cb00c to your computer and use it in GitHub Desktop.
Save mikeacjones/0c25d6b339e863e7df23c417135cb00c to your computer and use it in GitHub Desktop.
Example usage of hlLoop.dwl - building EDI data format
%dw 2.0
import * from dw::edi::hlLoop
output application/json
---
{
"Delimiters": "|>U\n",
TransactionSets: {
v004010: {
"856": [{
SetHeader: {
ST01: "856",
ST02: "0029"
},
SetTrailer: {
SE01: 61,
SE02: "0029"
},
Heading: {
"020_BSN": {
BSN01: "00",
BSN02: payload.salesOrder,
BSN03: payload.CreationDate as Date {format: "yyyyMMdd"},
BSN04: (((payload.CreationTime[0 to 1] as Number )*3600) + ((payload.CreationTime[2 to 3] as Number)*60))*1000,
BSN05: "0002"
},
"040_DTM": [{
DTM01: "011",
DTM02: payload.ActualShippingDate as Date {format: "yyyyMMdd"},
},
{
DTM01: "017",
DTM02: payload.EstimatedDeliveryDate as Date {format: "yyyyMMdd"},
}]
},
Detail: {
"010_HL_Loop": hlLoop(payload)
},
Summary: {
"010_CTT": {
CTT01: 27
}
}
}]
}
},
Interchange: {
ISA01: "00",
ISA02: " ",
ISA03: "00",
ISA04: " ",
ISA05: "14",
ISA06: "005003264NTST ",
ISA07: "ZZ",
ISA08: "ARIBAEDI ",
ISA09: "200806" as Date {format: "yyMMdd"},
ISA10: 56880000,
ISA11: "U",
ISA12: "00401",
ISA13: "000000028",
ISA14: "0",
ISA15: "P",
ISA16: ">"
},
Group: {
GS01: "SH",
GS02: "AN01000129150",
GS03: "AN01007218232",
GS04: "20200806" as Date {format: "yyyyMMdd"},
GS05: 56880000,
GS06: 29,
GS07: "X",
GS08: "004010"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment