calculation for string to double

  1. 4 weeks ago

    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.

  2. Jean-Yves P

    Nov 14 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 4 weeks ago

    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://docs.xojo.com/Val

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

  3. Tim P

    Nov 14 Pre-Release Testers feedback://46303

    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.
    https://www.xojo.com/learn/

    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://docs.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 :)

  4. Andrew L

    Nov 14 San Francisco, CA, USA
    Edited 4 weeks ago

    New is a keyword too.

  5. Jean-Yves P

    Nov 14 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    @Andrew L New is a keyword too.

    oups did not see this (huge) one mistake !

or Sign Up to reply!