Última actualización:

Add functions to calculation formulas

Learn how to add functions to calculation formulas via the web app and the mobile app.

¿Qué significa añadir funciones a las fórmulas?

Extraer manualmente datos de inspecciones y transferirlos a hojas de cálculo para realizar cálculos puede ser una tarea lenta e ineficiente. Al usar funciones en sus fórmulas de cálculo, podrá procesar y analizar datos directamente en SafetyCulture, sin depender de herramientas externas. Así obtendrá información en tiempo real justo cuando se captura, lo que le permitirá tomar decisiones más rápidas y basadas en datos.

Los usuarios deben tener la versión 25.12 o posterior de la aplicación móvil de SafetyCulture para ver las funciones añadidas a las preguntas de cálculo en las inspecciones.

Add functions to a calculation formula

  1. Log in to the web app.

  2. Select Templates iconPlantillas from the menu on the left-hand side.

  3. Click the template and select Editar plantilla in the side panel.

  4. Add a new number response question or select an existing one.

  5. Create or edit a calculation formula.

  6. In the side panel, type $ and select the function you want to use. Then, type $ followed by a question's label to use it as an argument. Please note that functions are case-sensitive.

    • You can also select the relevant function and question from the "Functions" and "Questions" dropdowns.

  7. Click Guardar y aplicar.

  8. Click Publicar on the upper-right of the page to publish the template. If you're not ready to publish the template, you can go back to the template list and publish the changes when you're ready.

  1. Open the mobile app.

  2. Tap Inspections icon mobileInspecciones at the bottom of your screen.

  3. Select Plantillas tab at the top of your screen.

  4. Tap the template and select Pencil iconEditar plantilla from the pop-up options.

  5. Add a new number response question or select an existing one.

  6. Under the question, tap More vertical icon on the right-hand side of "Number" and tap Número next to "Format".

  7. On this screen, select Cálculo.

  8. Type $ and select the function you want to use. Then, type $ followed by a question's label to use it as an argument. Please note that functions are case-sensitive.

    • You can also select the relevant function and question from the "Functions" and "Questions" dropdowns.

  9. Tap Guardar y aplicar.

  10. Tap Publicar on the upper-right of the screen to publish the template. If you're not ready to publish the template, you can go back to the template list and publish the changes when you're ready.

Las fórmulas que utilizan preguntas numéricas con unidades no se convertirán automáticamente.

Por ejemplo, si está calculando la velocidad en kilómetros por hora y hace referencia a una pregunta numérica que utiliza metros como unidad en su cálculo, los metros no se convertirán a kilómetros. Deberá cambiar la unidad en la pregunta numérica o la pregunta numérica en su totalidad.

Available functions

This table outlines all the available functions for calculation formulas. In a function, "Value" can either be a referenced question or an integer.

Function

Format

Description

SQRT (Square root)

SQRT(Value)

Returns the square root of the value. For example, SQRT(9) = 3.

ABS (Absolute value)

ABS(Value)

Returns the absolute (positive) value of the input. For example, ABS(-5) = 5.

SIN (Sine)

SIN(Value)

Returns the sine of the given radian. For example, SIN(3.14 / 2) = 1.

COS (Cosine)

COS(Value)

Returns the cosine of the given radian. For example, COS(0) = 1.

POWER

POWER(Value 1, Value 2)

Raises the first value to the power of the second. For example, POWER (2,3) = 8.

LOG

LOG(Value 1, Value 2)

Returns the logarithm of the first value to the base of the second. For example, LOG(8,2) = 3.

SUM

SUM(Value 1, Value 2)

Calculates the sum of all values. For example, SUM(1,5,9) = 15.

AVERAGE

AVERAGE(Value 1, Value 2)

Computes the average (mean) of all values. For example, AVERAGE(4,8,12) = 8.

MEDIAN

MEDIAN(Value 1, Value 2)

Returns the median value from the input numbers. For example, MEDIAN(3,1,4,2,5) = 3.

MODE

MODE(Value 1, Value 2)

Returns the most frequently occurring value from the given values. For example, MODE(3,5,3,7,5,5) = 5.

STDEV (Standard deviation)

STDEV(Value 1, Value 2)

Calculates the standard deviation of the given values. For example, STDEV(4,8,6,5,9) = 1.87.

AVEDEV (Average deviation)

AVEDEV(Value 1, Value 2)

Calculates the average deviation of the given values. For example, AVEDEV(4,8,6,5,9) = 1.68.

DEFAULT_VALUE

DEFAULT_VALUE(Question, Default value)

The DEFAULT_VALUE function will need to reference a question and an integer in the respective order.

Returns the default value if a referenced question is unanswered. For example, DEFAULT_VALUE(Question, 15).

If the question is answered, the function is equal to the number entered.

If unanswered, the function is equal to 15.

ROUND

ROUND(Value)

ROUND(Value 1, Value 2)

Rounds the value to the nearest whole number or to a defined number of decimal places. For example, ROUND(21.1171, 2) = 21.12.

CEIL (Ceiling)

CEIL(Value)

CEIL(Value 1, Value 2)

Rounds the value up to the nearest whole number or up to a defined number of decimal places. For example, CEIL(21.1171, 3) = 21.118.

FLOOR

FLOOR(Value)

FLOOR(Value 1, Value 2)

Rounds the value down to the nearest whole number or down to a defined number of decimal places. For example, FLOOR(21.1171, 1) = 21.1.

Preguntas frecuentes

Un argumento es un valor o entrada de datos que una función utiliza para realizar un cálculo. En las fórmulas de cálculo, los argumentos pueden ser números o preguntas, y van entre paréntesis. Algunas funciones admiten varios argumentos para ajustar aún más los cálculos.

Por ejemplo, en la fórmula AVERAGE(Pregunta 1, Pregunta 2, Pregunta 3), cada pregunta referenciada cuenta como 3 argumentos independientes.

Aunque las preguntas para respuesta de cálculo son compatibles con las secciones de repetición, hay casos en los que no podrá crear una fórmula y un número de referencia o una pregunta para respuesta de cálculo en las secciones de repetición.

Caso 1: Una fórmula dentro de una sección de repetición no puede hacer referencia a un número o una pregunta para respuesta de cálculo que sea parte de una sección de repetición anidada.

En el siguiente ejemplo, la pregunta de respuesta de cálculo Total - Principal no puede hacer referencia a preguntas de respuesta numérica en las secciones de Repetición (Secundario), ya que está anidada dentro de la sección de Repetición (Principal).

Ejemplo de caso de referencia de un número o una pregunta de respuesta de cálculo en las secciones repetidas a través de la aplicación web.

Caso 2: Una fórmula dentro de una sección de repetición no puede hacer referencia a un número o a una pregunta para respuesta de cálculo de una sección de repetición independiente.

En el siguiente ejemplo, Total - 2 la pregunta de respuesta de cálculo no puede hacer referencia a preguntas de respuesta numérica en las Secciones de repetición (1) , ya que las preguntas se encuentran en secciones de repetición independientes.

Ejemplo de caso de referencia de un número o una pregunta de respuesta de cálculo en las secciones repetidas a través de la aplicación web.

Si su inspección incluye una fórmula de cálculo con funciones, es posible que reciba un mensaje de error en versiones de la aplicación móvil anteriores a la 25.12. Aunque los datos introducidos se calcularán y se podrán ver en la aplicación web, se recomienda mantener la aplicación móvil actualizada para poder ver correctamente las funciones dentro de las inspecciones.

¿Necesita más ayuda?
En este artículo