*[math] calculates equations using numbers, dates or time. It can also set variables to be used throughout the page. One common use of a math variable is to create counters.*

interpreted = N

texte = [math

the name of a math variable is limited to 15 alphanumeric characters, and must begin with a letter.

When actually setting a math variable, the value will display, unlike a text variable. To prevent this, addYou can assign multiple math variables at the same time using a semicolon to separate the assignments. Example: [math show=f]var1=1;var2=2[/math].

[lineitems][quantity], [ref], [price], [math][price]*[quantity][/math][/lineitems]

[math show=f]counter=0[/math][founditems][hideif [somecondition]=something][math]counter=counter 1[/math]. [firstname] [lastname]<br>[/hideif][/founditems]There were [counter] names found.In this example, some of the founditems are eliminated via the [hideif]. In this case, [index] and [numfound] would still include the eliminated items, and would not be useful to number the lines, nor to obtain a final count. The first line sets the initial value of [counter] to 0.

sometimes you want to calculate something without displaying the results, perhaps while calculating a running total. To do this, put "show=F" into the math parameters, as in [Math show=F]total=total [subTotal][/Math]. This allows you to perform calculations in the middle of a web page without the intermediate numbers appearing to the visitor. Later, you can show the value of the math variable with [Math]total[/Math].

[math](4.5 6.2)/17*95-12[/math] | 47.7941176470588 |

[math]{4/7/1997} + 10[/math] | 729496 (4/7/1997 + 10 days expressed as number of days since 00/00/0000) |

[math]{4/7/1997} + {02/00/0000}[/math] | 729547 (4/7/1997 + 2 months expressed as days since 00/00/0000) |

[math date]{4/7/1997} + 10[/math] | 04/17/1997 (4/07/1997 + 10 days expressed as date) |

[math date]{4/7/1997} + {02/00/0000}[/math] | 06/07/1997 (4/17/1997 + 2 months expressed as date) |

[math date]{[date]}-{00/07/0000}[/math] | 09/01/2008 (One week ago today) |

[math]{12:51:02}[/math] | 46262 (number of seconds between midnight and 12:51:02 expressed as seconds) |

[math time]{12:51:02} + {01:00:05}[/math] | 13:51:07 (12:51:02 pm plus 1 hour and 5 seconds expressed as time) |

[math]x=5/3[/math] | 1.66666666666667 |

[math]x=5%3[/Math](% = Modulo Operator) | 2 |

<SELECT NAME="StartYear">[loop start=[date %Y]&end=[math][date %Y] + 10[/math]]<OPTION[showif [date %Y]=[index]] selected[/showif]>[index]</option>[/loop]</SELECT>

[math]ceil(1.5)[/math][math]sin([formvalue])*cos(3.1415)[/math]

Function | Description |
---|---|

sin(x) | returns sine of x. |

cos(x) | returns cosine of x. |

tan(x) | returns tangent of x. |

asin(x) | returns arcsine of x. |

acos(x) | returns arccosine of x. |

atan(x) | returns arctangent of x. |

sinh(x) | returns hyperbolic sine of x. |

cosh(x) | returns hyperbolic cosine of x. |

tanh(x) | returns hyperbolic tangent of x. |

log(x) | return natural log of x. |

log10(x) | returns log base 10 of x. |

sqrt(x) | returns square root of x sqrt(16) = 4. |

floor(x) | rounds down to next-lower integer. floor(2.9) = 2. |

ceil(x) | rounds up to next-higher integer. ceil(3.1) = 4. |

abs(x) | returns absolute value of x. abs(-3.4) = 3.4. |

deg(x) | converts radians to degrees. |

rad(x) | converts degrees to radians. |

you may use [format] to convert an integer number to a date or time. Use [Format Days_To_Date] and [Format Seconds_To_Time] to convert integer numbers to their equivalent dates/times. As already noted above, the integer number represents the number of days since January 1, 0000 and for time, the number of seconds since midnight.

[Format Days_To_Date]729496[/Format] yields 4/17/1997[Format Seconds_To_Time]46262[/Format] yields 12:51:02[math] variable names allow 15 characters. There is no such limit for [text] variable names

[math[math]variable=value[/math]

[math] calculates the enclosed numerical, date, or time equation and displays the results. Any [xxx] variables are evaluated first, then the resulting equation is calculated. Standard algebraic order of operations are followed when evaluating expressions. Use parentheses to clarify or force a specific order of operations. To work with dates and times, put them inside curly-braces: {12/01/2010}. This converts them into numbers so they can be properly treated as numbers (more details in below).

You may also create up to 150 math variables by name. These named variables can be used in any other [math] context, or elsewhere in the page just like a text variable. When used within a math context, math variables do not need the square brackets. Otherwise they need the brackets, just like a text variable.

the name of a math variable is limited to 15 alphanumeric characters, and must begin with a letter.

When actually setting a math variable, the value will display, unlike a text variable. To prevent this, add

You can assign multiple math variables at the same time using a semicolon to separate the assignments.

Example: [math show=f]var1=1;var2=2[/math].

[lineitems]

[quantity], [ref], [price], [math][price]*[quantity][/math]

[/lineitems]

[math show=f]counter=0[/math]

[founditems]

[hideif [somecondition]=something]

[math]counter=counter 1[/math]. [firstname] [lastname]<br>

[/hideif]

[/founditems]

There were [counter] names found.

In this example, some of the founditems are eliminated via the [hideif]. In this case, [index] and [numfound] would still include the eliminated items, and would not be useful to number the lines, nor to obtain a final count. The first line sets the initial value of [counter] to 0.

Dates included in mathematical expressions must be enclosed in curly braces. (You cannot mix both dates and times in one equation.) This converts them to a number (the number of days since 01/01/0000) so math can be performed. You may easily add or subtract days, months, or years from dates by expressing them in date format within curly braces. Just use 0 for values you want ignored. For instance, in order to add 2 months to today's date you would write: [math date]{[date]} {2/0/0000}[/math]. Then to redisplay the result back into date format, add the

sometimes you want to calculate something without displaying the results, perhaps while calculating a running total. To do this, put "show=F" into the math parameters, as in [Math show=F]total=total [subTotal][/Math]. This allows you to perform calculations in the middle of a web page without the intermediate numbers appearing to the visitor. Later, you can show the value of the math variable with [math]total[/Math].

[math](4.5 6.2)/17*95-12[/math] | 47.7941176470588 |

[math]{4/7/1997} + 10[/math] | 729496 (4/7/1997 + 10 days expressed as number of days since 00/00/0000) |

[math]{4/7/1997} + {02/00/0000}[/math] | 729547 (4/7/1997 + 2 months expressed as days since 00/00/0000) |

[math date]{4/7/1997} + 10[/math] | 04/17/1997 (4/07/1997 + 10 days expressed as date) |

[math date]{4/7/1997} + {02/00/0000}[/math] | 06/07/1997 (4/17/1997 + 2 months expressed as date) |

[math date]{[date]}-{00/07/0000}[/math] | 09/01/2008 (One week ago today) |

[math]{12:51:02}[/math] | 46262 (number of seconds between midnight and 12:51:02 expressed as seconds) |

[math time]{12:51:02} + {01:00:05}[/math] | 13:51:07 (12:51:02 pm plus 1 hour and 5 seconds expressed as time) |

[math]x=5/3[/math] | 1.66666666666667 |

[math]x=5%3[/Math](% = Modulo Operator) | 2 |

Pulldown list populated with the current year up to 10 years (variable) out using the [math] context.

<SELECT NAME="StartYear">

[loop start=[date %Y]&end=[math][date %Y] + 10[/math]]

<OPTION[showif [date %Y]=[index]] selected[/showif]>[index]</option>

[/loop]

</SELECT>

Examples:

[math]ceil(1.5)[/math]

[math]sin([formvalue])*cos(3.1415)[/math]

Function | Description |
---|---|

sin(x) | returns sine of x. |

cos(x) | returns cosine of x. |

tan(x) | returns tangent of x. |

asin(x) | returns arcsine of x. |

acos(x) | returns arccosine of x. |

atan(x) | returns arctangent of x. |

sinh(x) | returns hyperbolic sine of x. |

cosh(x) | returns hyperbolic cosine of x. |

tanh(x) | returns hyperbolic tangent of x. |

log(x) | return natural log of x. |

log10(x) | returns log base 10 of x. |

sqrt(x) | returns square root of x sqrt(16) = 4. |

floor(x) | rounds down to next-lower integer. floor(2.9) = 2. |

ceil(x) | rounds up to next-higher integer. ceil(3.1) = 4. |

abs(x) | returns absolute value of x. abs(-3.4) = 3.4. |

deg(x) | converts radians to degrees. |

rad(x) | converts degrees to radians. |

When using time mixed with integers, the final result is a value respresenting a number of seconds (e.g. {10:15:31} + 10 adds 10 seconds to the time). In fact, the result of a math expression with time is always the number of seconds. To display the output of the math expression as a time, add the Time modifier to the [math] context: [math time]...[/math].

you may use [format] to convert an integer number to a date or time. Use [Format Days_To_Date] and [Format Seconds_To_Time] to convert integer numbers to their equivalent dates/times. As already noted above, the integer number represents the number of days since January 1, 0000 and for time, the number of seconds since midnight.

[Format Days_To_Date]729496[/Format] yields 4/17/1997

[Format Seconds_To_Time]46262[/Format] yields 12:51:02

[math] variable names allow 15 characters. There is no such limit for [text] variable names

**DOWNLOAD WEBDNA NOW!**

WebDNA applications...

A list of user-submitted tips ...

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

...

A list of available libraries for WebDNA...

A list of the currently available modules...

[url]...

displays the last auto-generated number...

Lists all the form variables and parameters passed to the current page...

Prevents other threads from simultaneously accessing a group of databases...

...

This instructions move a file from one location to another...