Instalink Scripting Documentation

Dates

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

Encoding

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

Lists

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

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 Without Entry
Map Get
Map Has Key
Map Keys
Merge Maps
Map Pairs
Map With Entry
Map Size
Map Values

Math

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

Other

Lookup

Text

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

Type Conversions

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

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~"