You can create a custom DataHooks to split 2 fields by a specific value.
Let's consider an example - a person's first name and last name are both inside the same row under the firstName field. We can use the code snippet below to evaluate if there is a space (" ") between values in that row. If there is, then the code snippet below will automatically separate those 2 values into firstName and lastName fields by a specific value of a space (" ").
if (row['firstName'] && !row['lastName']) {
if (row['firstName'].includes(" ")) {
const components = row['firstName'].split(" ");
row['firstName'] = components.shift();
row['lastName'] = components.join(" ");
}
}
return { row, info: [] }
Comments
0 comments
Please sign in to leave a comment.