Let’s assume you have two tables Table1 and Table2.
Table1 has one column TextColumn, which contains the text string.
Table2 has two columns WordColumn and ValueColumn.
You want to create a new column in Table1, let’s call it UpdatedTextColumn, where each text string from TextColumn will replace words that are found in WordColumn with the corresponding value from ValueColumn.
Im splitting the sentence on a SPACE, then running a forEach loop over that. Bascially evaulating each word saying
Hey Coda, if the current word in the sentence which you are looking at happens to be in the second table, then go ahead and look into the second table, find which row it matches specifically, and replace it with the value corresponding to that word.
If its NOT in the table, well dont do anything
I tried the example, but unfortunately it didn’t quite work in my use case, I probably should’ve had another example.
I unfortunately cannot split by " ", as, if the sentence has punctation next to the keyword, the replacement falls apart.
If the input TextColumn said “I hate dogs. cats are cool though”, then it wouldn’t be able to find the word “dogs” because splitting it would produce “dogs.”
It would also need to keep the line breaks, which yours did, but it looks like in the Result column, it might be keeping it as a whole word since the ‘space’ is technically not a " ", so in that case it could also miss finding a keyword.