Example of using Custom selection option in Log variables to file action
- Updated: 2023/08/04
Example of using Custom selection option in Log variables to file action
In this example, you will use the Custom selection option to log user-defined variables to an existing log file and then modify the values of the variables and log the appended data into a file.
Procedure
-
Create a bot.
-
On the left panel, click Automation.
A list of available bots and forms is displayed.
- Click Create New > Task Bot.
- Enter a name for the bot: Log user defined variables
- Click Create and Edit.
-
On the left panel, click Automation.
-
Create the following user-defined variables using the Create variable (+) icon at the top of the
Variables menu.
Data type Variable name Variable value String Day_1 monday String Day_2 Tuesday String Day_3 Wednesday Number Temperature_Mon 9.3555555555555589 Number Temperature_Tues 10.82222222222222 Number Temperature_Wed 17.800000000000004 Datetime Time_Mon 5/7/2023 01:15 AM Datetime Time_Tues 5/8/2023 01:00 AM Datetime Time_Wed 5/9/2023 01:00 AM Boolean Chances_of_rain_Mon True Boolean Chances_of_rain_Tues False Boolean Chances_of_rain_Wed True -
Double-click or drag the Log to file > Log variables to file
action.
- In the Output file path field, specify the file location. For example, D:\userdefined path\weather_forecast-data.txt.
- In the When logging field, select Overwrite existing log file option.
- In the Variables to log field, select the Custom selection option and select all variables as follows:
-
Click Save and then Run.
The data is logged as follows:
-
Double-click or drag the String > Uppercase
action.
- In the Source string field, select Day_1 to insert the variable.
- In the Assign the output to variable field, select the Day_1 variable from the drop-down.
-
Double-click or drag the Number > Increment
action.
- In the Enter number field, select Temperature_Tues to insert the variable.
- Enter 15 in the Enter increment value field.
- In the Assign the output to variable field, select Temperature_Tues variable from the drop-down.
-
Double-click or drag the Boolean > Invert action.
- From the Select the boolean variable to be inserted field, select the True option.
- In the Assign the output to field, select the Chances_of_rain_Wed variable from the drop-down.
-
Double-click or drag the Log to file > Log variables to file
action.
- In the Output file path field, specify the file location. For example, D:\userdefined path\weather_forecast-data.txt.
- In the When logging field, select Append to existing log file option.
- Select the Append timestamp check box.
- In the Variables to log field, select the Custom selection option and select all variables as previously shown in Step 3c.
-
Click Save and then
Run.
The updated data is logged with the timestamp details in the file as follows.