English (Español a continuación)
It is a function of type «string» that allows converting a character string into a number of type «double».
For example, having a member whose name is of type text «01», this function allows to convert it to the number 1.
- @CalcMgrDoubleFromString («01») = 1
This function can be used within a calculation.
Let’s see an example:
Suppose we have in the database a dimension «Products» with the following members:
- P_05
- P_08
- P_10
We want to extract from the name of these products the digits they contain since they indicate the % discount that is applied to customers. For this we use this function (in conjunction with the @SUBSTRING function).
- @CalcMgrDoubleFromString (@SUBSTRING (“Products”, 2))
The @SUBSTRING function obtains the characters of the names of these products from the third to the end:
- @SUBSTRING («P_05», 2) = «05»
- @SUBSTRING («P_08», 2) = «08»
- @SUBSTRING (“P_10”, 2) = “10”
The @CalcMgrDoubleFromString function converts the extracted character (strings) to numbers:
- @CalcMgrDoubleFromString (@SUBSTRING (“P_05”, 2)) = 5
- @CalcMgrDoubleFromString (@SUBSTRING (“P_08”, 2)) = 8
- @CalcMgrDoubleFromString (@SUBSTRING (“P_10”, 2)) = 10
Español
Es una función del tipo “string” que permite convertir una cadena de caracteres en un número de tipo “double”.
Por ejemplo, teniendo un miembro cuyo nombre es de tipo texto “01”, esta función permite convertirlo en el número 1.
- @CalcMgrDoubleFromString(“01”) = 1
Esta función se puede utilizar dentro de un cálculo.
Veamos un ejemplo:
Supongamos que tenemos en la base de datos una dimensión “Productos” con los siguientes miembros:
- P_05
- P_08
- P_10
Queremos extraer del nombre de estos productos el dígito que contienen ya que indican el % de descuento que se aplica a los clientes. Para ello utilizamos esta función (en unión con la función @SUBSTRING).
- @CalcMgrDoubleFromString(@SUBSTRING(“Productos”,2))
La función @SUBSTRING obtiene los caracteres los nombres de estos productos desde el tercero hasta el final:
- @SUBSTRING(“P_05”,2) = “05”
- @SUBSTRING(“P_08”,2) = “08”
- @SUBSTRING(“P_10”,2) = “10”
La función @CalcMgrDoubleFromString convierte las cadenas de caracteres extraídas en número:
- @CalcMgrDoubleFromString(@SUBSTRING(“P_05”,2)) = 5
- @CalcMgrDoubleFromString(@SUBSTRING(“P_08”,2)) = 8
- @CalcMgrDoubleFromString(@SUBSTRING(“P_10”,2)) = 10