Assign

Created by akaBot Support, Modified on Fri, 1 Nov, 2024 at 4:06 PM by akaBot Support

This is an explanation of the "Assign" activity, which is used to assign values like numbers to variables or arguments.


Table of contents

1. Activity Program Name

2. Description

3. Properties

4. Usage



1. Activity Program Name

System.Activities.Statements.Assign


2. Description


Quick access: "Toolbox" > "Orginal" > "Assign"



Assigns a specified value to a variable or argument.

Note: Verified on akaBot Studio versions 2.2.0.5. Terminology may vary depending on the version.


3. Properties


Property itemsProperty nameInput fieldDescription
Others
PublicCheckbox

Logs variables and arguments within the activity to a log file and pushes them to Center. (For details, refer to "Public Property Item").


Assignment target
Enter variable or argument (OutArgument type)
Specify the variable or argument to receive the "Value" property.

Value
Enter value (InArgument type)
Enter the value, variable, or argument to be assigned to the "Assignment Target" property.

Display name
Enter value (String type)
Reflects the activity name in the Designer panel.


4. Usage

You can assign values such as integers, strings, variables, and arguments. Here are some examples of how to use the "Assign" activity:


(1) Assigning a Numeric Value

This example demonstrates replacing a numeric value using the "Assign" activity. First, create a variable named Test_Value (Int32 type) in the Variables panel with a default value of 10. For instructions on creating variables, refer to "Creating Variables."



To display the current value of the variable Test_Value in the "Output," drag and drop the "Core > Log Message" activity from the toolbox into the Designer panel.



Enter the variable Test_Value in the "Message" property.



Drag and drop the "Original > Assignment" activity onto the designer panel.



Input the variable Test_Value into the "Target" property and enter 10000 into the "Value" property.



To verify the value of the variable Test_Value, place the "Log Message" activity again, input the variable Test_Value into the "Message" property.



Click "Home > Start" or press the "F5" key to execute and check the "Output." You will see that the value of Test_Value has been replaced from 10 to 10000 due to the use of the "Assignment" activity.



(2) Assigning a Calculation Expression As an example, we will input a string calculation expression. First, create the variable Test_String (of type String) with a default value of "Before" in the variable panel. Please refer to "How to create variables" for instructions on how to do this.



Place the "Log Message" activity and input the variable Test_String into the "Message" property.



Drag and drop the "Original > Assignment" activity onto the designer panel. 

Input the variable Test_String into the "Target" property and enter Test_String + "After" into the "Value" property.



To verify the value of the variable Test_String, place the "Log Message" activity again and input the variable Test_String into the "Message" property.



Click "Home > Start" or press the "F5" key to execute and check the "Output." You will see that the value of Test_String has been replaced from "Before" to "BeforeAfter" due to the use of the "Assignment" activity.



In this case, we assigned a calculation expression with a String type variable, but it can also be used as a counter. For example, by preparing a variable Counter (of type Int32) and entering Counter into the "Target" property and Counter + 1 into the "Value" property, it can be used as a repeating counter.


You can specify not only variables but also arguments in the "Target" property, and in the "Value" property, you can add multiple variables together.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article