replace multiple text elements in a text document | Community
Skip to main content
Level 3
February 26, 2025
Solved

replace multiple text elements in a text document

  • February 26, 2025
  • 1 reply
  • 517 views

Hi,

 

I'm trying to build a scenario that will download a document (Closed Captioning file), then using a control project in Workfront that contains all the words (Tasks) that need replaced or "bleeped" and replacing them within the document.
I understand how I would do this for 1 word, but how do I loop the output of the first replacement into the 2nd replacement and so on.....

 

thanks for any advice,

Kelly

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by _Manish_Singh

I have not tried this, so I'm not certain if this will work, but...

It appears you will need to use the 
set variable module to store your first replacement output. Then, retrieve this information using the get variable module in the loop.

The get variable will be blank the first time, but you can manage this by using the if() function in combination with the replace() function. If the get variable text is blank, use the document text for replacement; otherwise, use the get variable text.

iterator for task names >> get variable >> set variable (if and replace) >> dummy aggregator.

1 reply

Level 3
February 26, 2025

A little more context.

 

This is the content of my document:

A brown fox dashed through the meadow one night,
His tail held high and his grin just right.
He leaped over fences, he spun in the air,
Stealing a snack with the greatest of flair!

 

Here is my list of words with replacements in the control project:

Search for:       Replace with:

brown               b****

snack               s*****

 

Here is an example of the output that I would like:

A b**** fox dashed through the meadow one night,
His tail held high and his grin just right.
He leaped over fences, he spun in the air,
Stealing a s***** with the greatest of flair!

_Manish_Singh
_Manish_SinghAccepted solution
Level 9
February 27, 2025

I have not tried this, so I'm not certain if this will work, but...

It appears you will need to use the 
set variable module to store your first replacement output. Then, retrieve this information using the get variable module in the loop.

The get variable will be blank the first time, but you can manage this by using the if() function in combination with the replace() function. If the get variable text is blank, use the document text for replacement; otherwise, use the get variable text.

iterator for task names >> get variable >> set variable (if and replace) >> dummy aggregator.

Level 3
February 27, 2025

Thank you Manish.  This technique worked!!