There are two ways to integrate an importer. You can load an importer by using a template key corresponding to a pre-made template created in builder, or by utilizing a schema key and manually coding out custom column headers with rules and validations for your importer.
importmightymergeClientfrom'@mightymerge/client'varimporter=mightymergeClient({templateKey:'TEMPLATE_KEY',})importer.open({chunk:function (chunk){for (vari=0;i<chunk.records.length;i++){if (chunk.records[i].valid==true){// do something with valid record}}},complete:function (){// do something on complete},})
Schema
importmightymergeClientfrom'@mightymerge/client'varimporter=mightymergeClient({schemaKey:'SCHEMA_KEY',})importer.open({schema:{headers:[{text:{label:'name',display:'Name',maxLength:55,required:true,},},// ...etc],},chunk:function (chunk){for (vari=0;i<chunk.records.length;i++){if (chunk.records[i].valid==true){// do something with valid record}}},complete:function (){// do something on complete},})
Schema Header Fields
TEXT
{
// Accepts any text input
text: { ... }
}
Name
Value
Default
Description
label
string
null
header label of final output
display
string
(same as label)
Display to user
description
string
null
Adds a description tipsy to the header column
maxLength
number
null
Max length of input
minLength
number
null
Min length of input
required
boolean
false
Is field required
regex
object
{}
Validate on regex {match: "/example/i", message: "Value must include 'example'"}
EMAIL
{
// Validates against email format
email: { ... }
}
Name
Value
Default
Description
label
string
null
header label of final output
display
string
(same as label)
Display to user
description
string
null
Adds a description tipsy to the header column
maxLength
number
null
Max length of input
minLength
number
null
Min length of input
required
boolean
false
Is field required
regex
object
{}
Validate on regex {match: "/example/i", message: "Value must include 'example'"}
CHOICE
{
// Validates against exclusive value options
choice: { ... }
}
Name
Value
Default
Description
label
string
null
Key header label of final output
display
string
(same as label)
Display to user
description
string
null
Adds a description tipsy to the header column
values
array
[]
List of available options
required
boolean
false
Is field required
BOOLEAN
{
// Validates against having a proper boolean value
boolean: { ... }
}
Name
Value
Default
Description
label
string
null
header label of final output
display
string
(same as label)
Display to user
description
string
null
Adds a description tipsy to the header column
trueOutput
string
‘TRUE’
Output when input value is true
falseOutput
string
‘FALSE’
Output when input value is false
required
boolean
false
Is field required
NUMBER
{
// Validates against having correct number value
number: { ... }
}
Name
Value
Default
Description
label
string
null
header label of final output
display
string
(same as label)
Display to user
description
string
null
Adds a description tipsy to the header column
maxValue
number
null
Max number value of input
minValue
number
null
Min number value of input
required
boolean
false
Is field required
DATETIME
{
// Validates against having a valid datetime
datetime: { ... }
}