Unable to multiply

I am trying to multiply total with number3
Here total is string which is number1+number2 (number1 and number2 are double)

I need to multiply the sum of number1 and number2 (total) with number3(double)

Can anyone help please

Here the type of variable “total” is string, you may have to convert that to double as you cannot multiply between a string variable and a double variable.


total = (number1 + number2).ToString()
totalDouble = Convert.ToDouble(total)
result = totalDouble * number3

totalDouble and result are of type double

Use Log Message

"The result is: " + result.ToString()

Hi @dipon1112000

I think tax_on_tax_added var is in string.covert it into double and check

Hope it helps!!

Thank you for your help I have tried doing it but I am getting another error

Here total is double= (number1+number2). toString

Number2 has default value of 4.5


Please Try my approach Hope it helps.

Hey @dipon1112000

Change the Variable type of "total" to Double.

@rlgandu what is the variable for totalDouble


totalDouble is a double type Variable which stores the Total as Double

The technical error is that total is of type string, so you can’t make calculations with it.
There are a milion ways to rewrite the code to a working state but in general consider this:

number * text = error

Which causes the type conversion error.
So in order to fix it, transform the text to a number:

number * text as number = another number

In code: number3 = cdbl(total * number3)
where cdbl casts a numeric string into a double datatype.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.