Calculation: Difference between revisions
Created page with "File:Calculation.png == Description == The Calculation control lets you display the result of a calculation without doing any coding. As the input values of the formula..." |
|||
(One intermediate revision by the same user not shown) | |||
Line 23: | Line 23: | ||
Standard [[events|events]] are supported. | Standard [[events|events]] are supported. | ||
== Examples == | == Examples of value of Formula == | ||
=== Multiply the value of two fields === | === Multiply the value of two fields === | ||
Line 55: | Line 55: | ||
[[Category:General]] | [[Category:General]] | ||
[[Category:Common]] |
Latest revision as of 22:12, 9 March 2019
Description
The Calculation control lets you display the result of a calculation without doing any coding. As the input values of the formula are changed, the value displayed in the control is automatically updated.
To add a Calculation control to your app, choose the Calculation icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need.
The most important property is formula. It contains a expression which is used to calculate the value of the field. Terms can be numbers, functions and values of other controls. Keep in mind that if you use a value from a control, it will probably need to be converted from a string to a number using the Number function.
formula needs to be valid JavaScript. In most cases, BASIC syntax will be identical.
Properties
Standard properties are supported, plus:
formula | The expression to evaluate. Design time. |
Events
Standard events are supported.
Examples of value of Formula
Multiply the value of two fields
Number(TextBox1.value) * Number(TextBox2.value)
Convert Fahrenheit to Celsius
(Number(TextBox1.value) - 32) * 5/9
Concatenate Fields - it's not just for math!
txtFirstName + " " + txtLastName
You can even call a function!
factorial(Number(TextBox1.value)) Function factorial(n) if (n <= 1) return 1; return n*factorial(n-1); End Function