Search and replace file

Use this step to search and replace text in new file.

Last published at: September 1st, 2023

searchAndReplaceFile Step

Description:

This step does a search and replace text in a new file. 

 

Inputs

  • inputFilePath– Input file path
  • outputFilePath – Output file path
  • mappingString – Mapping of search and replace strings 
 

 

Outputs

  • True – step executed successfully
  • False – step failed to execute 
 

 

Usage:

 

 

Example:

Let’s build and execute the “searchAndReplaceFileDef” example.          

  • Create a new definition called “searchAndReplaceFileDef” 
  • Select the definition and click the “design” button
  • Drag a “searchAndReplaceFile” step from the toolbox
  • Connect the dots between the start and “searchAndReplaceFile” step 
  • Click on the “searchAndReplaceFile” step to configure its “Settings” properties. Provide a name to the step. Provide a file patch for input source. Provide a file path to store for output. Click on the button to map the search and replace strings.  

 

  •  Click on the button to map the search and replace strings.  

 

  • The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

 

  • Save the process definition, create a new process instance, and execute. Render the process instance. Click on the process step to view the properties. The step should search and replace file contents and create a new file.

 

Definition Sample:

You may download the sample definition(s) from the link here and later import it (drag-drop) to your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.

NOTE: Please verify and complete the process steps for any missing configurations, such as file path references and database connections after import. Then, save the definition to confirm the changes.

Click here to download the sample file.