I would like to use the JavaScript Transform to create a new column that contains the first word of an existing column.
What is the JavaScript to do so?
I didn’t see an example in the JavaScript Help documentation.
Perhaps the Extract Transform could contain some basic selectable arguments such as return First Word, First # words, Last word, Last # words.
Admin
February 15, 2021, 5:48pm
2
@DanFeliciano
To turn this:
Into:
It is probably simplest to use Replace with a regex.
NB/ You can also use regex inside a Javascript transform.
Vann
February 16, 2021, 2:38am
3
Why not use the Split transform with a delimiter of space with min and max of 1? I know you asked for JavaScript but if I understand the problem correctly this would be a
very simple solution.
2 Likes
Admin
February 16, 2021, 9:54am
4
Good call @Vann . That is simpler than a regex.