Type Cast
Last updated
Last updated
Type Cast action in the Avo Assure is found under the @Generic Element is used to convert the format from one variable to other and store the result in an output variable for further use.
Input: <Variable>;<typecast type>
Typecast type: It changes the type of data from one form to another so it can be used in the right way.
It takes the values in different ways shown as below:
a) Int (Integer): It is used to store numbers without any decimal or fractional part. It used to convert from another type to integer type (double to int, float to int).
b) Float: The float is used to convert numbers into decimal point. It used to convert from another type to float type (double to float, int to float).
c) Double: A double variable that stores numeric values with decimal points, such as floating-point numbers. It used to convert from another type to integer (int to double, float to double).
d) String: values of string variables may include numbers, letters, or symbols. It used to convert date type to string.
Output: <Display Variable>;<Display Variable>(Optional)
When testing a user registration form for a web application, the "Student Marks" field is expected to accept float values. However, you can currently enter marks as strings (e.g., "98"). To meet user requirements, these string inputs should be automatically converted to float values (e.g., "98.0"). This process involves updating the form's input handling to ensure all string entries are converted correctly into floats
Input: In input values user supposed to give input values as followed:
98;float
Expected Result: The application accepts the input and stores the marks as 98.0 (float type).
Output: The result of Type Cast action is stored in the {result} output variable as “98.0” (Float type), which can be utilized for display or other purposes.