Skip to main content
Skip table of contents

setNumber

A logic command that sets a variable with a Number value into the variable context.

Attributes

var

Required

Value type

EL-evaluated

Yes

String

No

Defines the name of the variable that will hold the Number.

value

Required

Value type

EL-evaluated

No

Any

Depends on the valueExpression attribute

Defines the Number value this command is setting. If the resolved value is a Number, that Number is used as is. If the resolved value is a String, it is parsed into the Number the String represents (an error occurs if the String cannot be parsed). If the resolved value is of any other kind, an error is produced.

If undefined or the resolved value is null, a Number with value of zero is set.

expressionType

Required

Value type

EL-evaluated

No

String

Yes

Defines how the value expression of the value attribute is resolved. The resolved String value of this attribute is expected to be one of the following:

  • el - The value attribute is handled like a normal EL-evaluated attribute.

  • shorthandEL - The value attribute is EL-evaluated, but if the value expression doesn't contain the ${ and }, the expression is evaluated as if it was wrapped within them.

  • static - The value attribute is not EL-evaluated, so the resolved value will always be a String. 

If this attribute is undefined, the value of "el" is used. 

Examples

Compared to set, the setNumber command allows for some more ways to create Numbers. All the following produce a Number:

CODE
<setNumber var="num1" value="${255}"><setNumber var="num2" value="${25 + 70}"><setNumber var="num3" value="73"><setNumber var="num4">
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.