Home Search

DriveWorks Pro 21
Find and Replace Values in a Text File

Send Feedback

Find and Replace Values in a Text File

This Specification Flow Task allows values in a text file to be replaced.

Properties

Property NameDescription
TitleChanges the Title (not the name) of the task.
Text File NameFull path, including extension, of the file that the text will be written to. This file must be a .txt file
Find and Replace ValuesPipe-bar (|) delimited string of find and replace values.Use the equals symbol to separate values (e.g FindValue1= ReplaceValue1| FindValue2= ReplaceValue2). Pipe and equal symbols can be escaped with a backslash.

Example

When this Task is added the properties are static. To be able to build rules on a static property see How To: Change A Static Property To A Dynamic Property.

Property NameExample RuleExample ResultMeaning
Text File Name"C:\MyDownloads\TextFile.txt"C:\MyDownloads\TextFile.txtThis is the name and full file path of the Text file that is to have values replaced.
Find and Replace Values"QuoteNumber=OrderNumber | CustomerContact=Contact"QuoteNumber=OrderNumber | CustomerContact=ContactWill replace each instance of QuoteNumber with OrderNumber and CustomerContact with Contact
Find and Replace Values (escaping = and | symbols)"\==Equals | \|=Pipebar"\==Equals | \|=PipebarWill replace each instance of = with Equals and | with Pipebar

Status Outputs

This task supports Status Outputs. These can be used to perform different actions depending on what the status outcome of the task is. For more information see Status Outputs in the Task Node Outputs section of Specification Macros Task Node.

The status output navigation is as follows:

Success

  • Text has been replaced in the Text file, (quantity of) changes have been made to the document.

Success with Warnings

  • No changes have been made in the Text file because no values could be matched in the document.

Failed (one of the following occurred).

  • The text file path cannot be blank, please enter a valid file path.
  • The find and replace string cannot be blank, please enter a valid find and replace values.
  • The file found is not a .txt file, please make sure to enter a .txt file.
  • The file path given can not be found. Please check your file path is correct.
  • The list of Strings have taken too long to parse, please consider using a smaller list or splitting the list up.
  • Unable to access the file path C:/Documents/Report.txt, please check the file path is correct and that you have permissions to access the directory.
  • Generic Error- Please check the exception in the Report.