Upland OL User community

Post Function Syntax


I’ve got an extract and want to add a post function to replace all instances of “_” with “”. I know the syntax for the replace but whats the syntax to access the original data that from the field the post function is on

In the Post function simply add what you would normally put after the “.” in Javascript code. In your case, simply put replace(/-/g,""). No dot or nothing just the replace function.

The post function act as a chaining function.

To better illustrate how the post function works, you have to picture what the extract step does: essentially, it creates a JavaScript snippet on the fly.

Say you’re extracting a CSV cell named FirstName. Behind the scenes, this extract step will be executed by the DataMapper as data.extract('FirstName')

As @hamelj explained, the Post function allows you to chain string methods to that piece of auto-generated JavaScript code, without specifying the initial dot.

In the images below, the highlighted portion of the statement is what the Extract step generates behind the scenes, and the rest is what you type in the Post function:

The only caveat of the Post function is that it must contain a series of chainable string methods. So you can’t use something like this:

because the plus signs (+) are not daisy-chainable.

Instead, you’d use:

This last statement would concatenate two fields together, with a blank space in between.

1 Like

Brilliant, thanks both that’s made it a lot clearer