Instalink Scripting Documentation

Dates

Adjust by Timezone
Current date
Current timestamp
Day of Month
Day of Week (number)
Day of Week (text)
Month (number)
Month (text)
Months ago
Truncate date to day
Truncate date to hour
Truncate date to minute
Truncate date to month
Truncate date to year
Year
Years ago

Encoding

Base 64 Decode
Base 64 Encode
CSV Decode
CSV Encode
JSON Decode
JSON Encode
URI Decode
URI Encode
X12 Decode
X12 Encode
XML Decode

Lists

Aggregate Array
Aggregate Array By Group
All But First Item in List
All But Last Item in List
Array To Map
Combine Two Arrays Without Duplicates
Count of Items in List
Each Item in List as List
Extract Part of Array
Filter List by Matches
Filter List by Non-Matches
Filter List: Unique
Filter List: Unique By Key
First Item in List
Flatten List
Flatten List Recursively
Get Common Items In Arrays
Get Item In List At Index
Group Array By Value
Join List Into Text
Last Item in List
List Append
List Contains Value
List Get Index
List Sort By Key
Pluck Values from List Items
Random Item in List
Randomize List
Remove Index From List
Removes Items From Array In Other Arrays
Reverse List
Set Item In List At Index
Sort List
Transpose List of Lists

Logic

And
Equal to
Exists
Greater Than
Greater Than or Equal
Less Than
Less Than or Equal
Match
Not equal to
Or
Xor

Maps

Map Get
Map Has Key
Map Keys
Map Pairs
Map Size
Map Values
Map With Entry
Map Without Entry
Merge Maps

Math

Absolute value
Add
Cube Root
Divide
Divide (whole number)
Exponent
Multiply
Negate
Random Number
Random Whole Number
Remainder
Round down
Round number
Round towards zero
Round up
Square Root
Subtract

Other

Lookup

Presets

ISO Country
ISO Subdivision

Text

Append Text
Capitalize words
Concatenate Text
Create Hash
Create HMAC Signature
Extract HTML Attribute
Extract HTML Text
Extract Inner HTML
Extract Outer HTML
Left trim text
Lower case
Prepend Text
Replace Text
Right trim text
Search Text
Split Text Into Lines
Split Text Into Words
Sub Text
Text Contains
Text length
Text split
Trim text
Upper case

Type Conversions

As Is
Boolean
Date
Date to String
List
Map
Number
Number to Fixed Decimal String
Text
Timestamp
Whole Number

X12 Encode | ENCODE_X12

Syntax

ENCODE_X12(
[value],
[transactionDefinition],
[transactionSummary],
[segmentTemplateKey],
[customSegmentTemplate],
[senderID],
[recipientID],
[version],
[interchangeControlNumber],
[groupIdentifierStr],
[groupControlNumber],
[customSegmentTemplateKey]
)                                                                                                                                                                                                                                                                                    

Parameters

value
An ARRAY value to encode formatted as a segment document.

transactionDefinition optional
Use a custom ISA/GS Envelope Header.

transactionSummary optional
Use a custom ISE/GE Envelope Footer.

segmentTemplateKey optional
Select one of the pre-included formats.

customSegmentTemplate optional
Define a custom set of segments to include in the document.

senderID optional
The ID of the sender. It is usually the sender business DUNS number.

recipientID optional
The ID of the recipient. It is usually the receipient business DUNS number.

version optional
The X12 version to validate against. Leave this blank for 00401 which is the most common.

interchangeControlNumber optional
The number used to identify this record between systems.

groupIdentifierStr optional
Two digit code that tells the validator what type of content to expect in the group.

groupControlNumber optional
The number used to identify the data grouped together in this record. Set this when using a custom template.

customSegmentTemplateKey optional
Tells the validator what X12 specification to validate against. Set this when using a custom template.

Return Value

A CSV encoded TEXT value.

Description

Encode a value in CSV format.

Examples

# VALUE is [ [ "ST" => [ [ "0", "0001" ] ], "SE" => [ [ "0", "0001" ] ] ] ]
ENCODE_X12(VALUE)
# Returns something similar to "ISA*00*          *00*          *01*0              *01*0              *$200101*0000*U*00401*000000000*0*P*<~GS*XX*0*0*20200101*0000*0*X*004010~ST*0*0001~SE*0*0001~GE*1*0~IEA*1*000000000~"