Description
Sometimes metadata is entered through CSV, XML, or by other methods that might have values you want to be in one field separated out into multiple fields.
NOTE: Modify your Metadata is only available in Capture Server Pro 1.10 and later.
Example
batch.Documents.forEach(function (doc) {
var firstNameValue = doc.Metadata["Index"]["FirstName"] != null ? doc.Metadata["Index"]["FirstName"] : "";
var lastNameValue = doc.Metadata["Index"]["LastName"] != null ? doc.Metadata["Index"]["LastName"] : "";
var fullNameValue = firstNameValue + " " + lastNameValue;
builder.SetDocumentMetadata(doc.DocumentId, "Index", "FullName", fullNameValue);
});
Our example below, will show how you can take a FirstName and LastName field and combine them into a field called FullName.
1. |
batch.Documents.forEach(function (doc) { |
|
First, we will cycle through the documents and grab the FirstName and LastName field values, so long as they're not null and populate the variables firstNameValue and lastNameValue respectively with the found values. |
2. |
var fullNameValue = firstNameValue + " " + lastNameValue; |
|
We will then build fullNameValue by concatenating firstNameValue and lastNameValue into a single field value. |
3. |
builder.SetDocumentMetadata(doc.DocumentId, "Index", "FullName", fullNameValue); |
|
Lastly, we will populate the metadata field FullName in the Index category of metadata on each of our documents with the value created as fullNameValue. |
Comments
0 comments
Please sign in to leave a comment.