Read Text

This activity helps you to read the entire data from a specified file. This activity supports only .txt files.

Technical Reference:

 

INPUT

FilePath: Specify the file path from which the data needs to be extracted.

 

 

 

 

 

 

 

MISC

Display Name: Displays the name of the activity. You can also customize the activity name to help troubleshoot issues faster. This name will be used for logging purposes.

SkipOnError: It specifies whether to continue executing the workflow even if it throws an error. This supports only Boolean value “True or False.”

True: Continues to execute the workflow irrespective of any error thrown.

False: Stops the workflow if it throws any error

Version: It specifies the version of the Text automation feature in use

 

OUTPUT

Text: Declare a variable here to retrieve the data as a string. This is not a mandatory field however declare a variable to get the result.

Textlist: Declare a variable here to retrieve the data as list of strings. This is not a mandatory field however declare a variable to get the result.

* Mandatory fields to execute the workflow.

The following activity illustrates on how we can use the read text activity to get the data from a .txt file. This can be extracted as strings or list of strings. 

This example shows how we can read the data as string and list of strings.

Example:

1.Drag and drop a read text activity to the workflow.

2.Click on the activity and enter the path of the file from which the data has to be extracted.

3.Declare a variable in the text box of the output segment if you need the retrieved data as a string. Here we have declared it as “Text”.

4.Declare a variable in the textlist box of the output segment if you need the retrieved data as list of strings. Here it is “Textlist”

5.Drag and drop a writelog activity below the readtext activity.

6.Enter the variable “Text” in the input string and give the log level as info. When the activity is executed, the bot retrieves the entire data from the file.

7.Enter the variable Textlist(0).ToString in the input string of the writelog box if you want to view the first string in the output box. If you want to view the second string enter, We add .ToString to the end as the writelog accepts only string values. Enter the log level as “info Textlist(1).ToString”.

When the activity is executed, the bot retrieves the first string of data, since we have entered Textlist(0).ToString and gives in the output box.

The bot executes the activity and shows the data as a string when the variable is given as “Text” and shows the data as list of strings when the variable is given as “textlist”.