Introduction to Math Functions in Viewer Apps
Viewer apps have become essential tools for accessing and interacting with various types of data and content. One key aspect that makes these apps powerful is the integration of math functions. Math functions are algorithms or procedures that manipulate numerical data to perform specific calculations or transformations. In the context of viewer apps, math functions are used to enhance the viewing experience, enable interactive features, and facilitate data analysis.
Math functions in viewer apps can range from simple arithmetic operations like addition and subtraction to more complex functions such as trigonometric calculations and statistical analysis. These functions provide the foundation for creating dynamic and interactive visualizations, helping users make sense of data in a meaningful way. By leveraging math functions, viewer apps can offer users a more intuitive and engaging experience, enabling them to explore and interact with content more effectively.
Important notice
Viewer does not protect your calculation from missing data or null, in any case that the data is missing / blank / null the document will fail and return error.
Please verify default values or preform the calculation in Salesforce
Commonly Used Math Functions
add
Return the sum of a
plus b
.
{{add 1 3 }}
<!-- results in: 12 -->
subtract
Return the product of a
minus b
.
{{subtract 3 1 }}
<!-- results in: 2 -->
divide
Divide a
by b
{{divide 6 3 }}
<!-- results in: 2 -->
toFixed
Formats the given number using fixed-point notation.
{{toFixed 12.12345 2 }}
<!-- results in: 1.12 -->
toInt
Formats the given number using fixed-point notation.
{{toInt 12.12345}}
<!-- results in: 12 -->
round
Formats the given number using fixed-point notation.
{{round 12.12345}}
<!-- results in: 12 -->
{{round 12.98765}}
<!-- results in: 13 -->
floor
Get the
of the given value. Math.floor()
{{floor 12.12345}}
<!-- results in: 12 -->
{{floor 12.98765}}
<!-- results in: 12 -->
ceil
Get the
of the given value. Math.ceil()
{{ceil 12.12345}}
<!-- results in: 13 -->
{{ceil 12.98765}}
<!-- results in: 13 -->
modulo
Get the remainder of a division operation.
{{modulo 5 2}}
<!-- results in: 1 -->
{{modulo 11 3}}
<!-- results in: 2 -->