calculation for string to double

I am a new to xojo and trying a develop an app with MySql database. I have successfully connected the database with xojo.

Now i am trying to have a equation y = a+b in the datasbase (a single column) where y is the output and a and b are input. I am trying to enter the input a,b from the frontend xojo and expecting the result of y in the fronend as output

Dim str as String
Dim new as double.
New =str(a+b)

I need to know, how to convert the calculation for string to double.

kindly help me. Thanks in advance.

str is a keyword (that transform a number to a string).
you cannot use it as a variable : “Dim str as String”

to convert a string to a double, the funtion is “Val” : https://documentation.xojo.com/api/text/val.html

you should use New = Val(a)+Val(b)

There’s a number of great resources for beginners.

First, if you’re an absolute beginner to programming, there’s the textbook. It teaches you to program as well as use Xojo at the same time. Great two-in-one system.

There’s also a manual that comes with Xojo that teaches you the ins and outs of using the IDE, the language, and the features within. You can find that in the Documentation folder next to your installation of Xojo. There’s also an online language reference http://documentation.xojo.com

Lastly, when you’re ready to learn from examples, there’s a folder full of example projects next to your Xojo install called “Example Projects” It helps when you don’t intend to reinvent the wheel. Do not copy and paste code from example projects, that won’t help you at all.

Best of luck to you :slight_smile:

New is a keyword too.

oups did not see this (huge) one mistake !