Remove Specific Characters from a Table's Column.¶
Legacy (Process Designer)
This page describes a script for the Modify Your Metadata activity of Process Designer. It was replaced by the Custom Step in Workflow. The script may not run as a Custom Step without changes. For new work, use the Custom Step reference.
This example shows how to remove non-numeric characters from cells in a Table's column.
var workingTable = builder.ConvertTableFieldToTableArray(batch.Documents[0].Metadata['Index']['TableField']);
var targetColumnIndex = 3;
if (workingTable[0].length > targetColumnIndex) {
for (var i = 0; i < workingTable.length; i++) {
workingTable[i][targetColumnIndex] = workingTable[i][targetColumnIndex].replace(/[^0-9$.,]/g, "");
}
builder.SetDocumentMetadata(batch.Documents[0].DocumentId, 'Index', 'TableField', builder.ConvertTableArrayToTableField(workingTable));
}