INSTR / INSTRING

English (Español a continuación)

The InStr / InString functions allow to locate the position of a string inside another.

  • The difference between them, as we will see below, is that in the “InStr” function you must indicate the position from which the search starts, while in the “InString” function this argument is optional.

Their structures are:

InStr(A, B, C, [D])

“A”: Indicates the position from which the search starts.

  • If this position is  >  1 Essbase starts searching from that position but the result indicates the position occupied by the found string starting counting from the first position.

“B”: String in which to search.

“C”: “String to search for”.

“D”: It is optional and defines if the search is case-sensitive or not. 2 possible values:

  • 0: Case-sensitive (default value)
  • 1: Case-insensitive

Example:

  • InStr(1,Product.currentmember.MEMBER_NAME,»01″)

Finds the position of the string «01» inside the name of the members of the «Product» dimension.

  • In those members in which this string does not exist, this function returns 0.

InString(A, B, [C], [D])

“A”: String in which to search.

“B”: String to search for.

“C”: It is optional; it indicates the position from which the search starts.

  • If not included the defaults value is 1 (the search starts from the first character of the argument “A”).
  • As in the previous function, if it is > 1 Essbase starts searching from that position but the result indicates the position occupied by the found string starting counting from the first position.
  • If this argument is omitted but the parameter “D” is included, its position must be indicated with a “,”: InString(A, B, , D)

“D”: It is optional and defines if the search is case-sensitive or not. 2 possible values:

  • 0: Case-sensitive (default value)
  • 1: Case-insensitive

Example:

  • InString(Product.currentmember.MEMBER_NAME,»01″,3)

Finds the position of “01” inside the name of the members of the “Product” dimension, starting to search from the third position.

  • In those members in which this string does not exist, this function returns 0.

Both functions can be used within a conditional structure: Suppose we include it in the outline in the member “Obj_2022” (of the dynamic dimension “Years”).

  • Case
    • When InString(Product.currentmember.member_name,”01”) = 4 then 100
    • When InString(Product.currentmember.member_name,”01”) = 5 then 120
    • When InString(Product.currentmember.member_name,”01”) = 6 then 140
    • Else 160
  • End

Assign the following values:

Any questions please send an email to: essbaseeasy@gmail.com

Español

Las funciones InStr / InString permiten localizar la posición que ocupa una cadena de caracteres dentro de otra.

  • La diferencia entre ellas, como veremos a continuación, es que en la función “InStr” hay que indicar la posición desde la que se inicia la búsqueda mientras que en la función “InString” este argumento es opcional.

Sus estructuras son:

InStr(A, B, C, [D])

“A”: Indica la posición desde la que se inicia la búsqueda.

  • Si se indica una posición superior a 1 para comenzar la búsqueda, Essbase comienza a buscar a partir de dicha posición pero el resultado señala la posición que ocupa la cadena encontrada comenzando a contar desde la primera posición.

“B”: Cadena en la que se busca.

“C”: Cadena que se busca.

“D”: Es opcional y define si la búsqueda es case-sensistive o no. Puede tomar 2 valores:

  • 0: Case-sensitive (valor que toma por defecto)
  • 1: Case-insensitive

Ejemplo: Partiendo del siguiente outline:

  • InStr(1,Producto.currentmember.MEMBER_NAME,”01”)

Indica la posición que ocupa la cadena “01” en el nombre de los miembros de la dimensión “Producto”.

  • En aquellos miembros en los que no existe esta cadena esta función da como resultado 0.

InString(A, B, [C], [D])

“A”: Cadena en la que se busca.

“B”: Cadena que se busca.

“C”: Es opcional, indica la posición desde la que se inicia la búsqueda.

  • Si no se incluye Essbase toma por defecto el valor 1 (la búsqueda se inicia desde el primer carácter del argumento “A”).
  • Al igual que en la función anterior, si se indica una posición superior a 1 para comenzar la búsqueda Essbase comienza a buscar a partir de dicha posición pero el resultado señala la posición que ocupa la cadena encontrada comenzando a contar desde la primera posición.
  • Si se omite este argumento pero se incluye el parámetro “D” hay que indicar su posición con una “,”: InString(A, B, , D)

“D”: Es opcional y define si la búsqueda es case-sensistive o no. Puede tomar 2 valores:

  • 0: Case-sensitive (valor que toma por defecto)
  • 1: Case-insensitive

Ejemplo:

  • InString(Producto.currentmember.MEMBER_NAME,”01”,3)

Indica la posición que ocupa en el nombre de los miembros de la dimensión “Producto” la cadena “01”, comenzando a buscar desde la tercera posición.

  • En aquellos miembros en los que no existe esta cadena esta función da como resultado 0.

Ambas funciones se pueden utilizar dentro de una estructura condicional: Supongamos que la incluimos en el outline en el miembro “Obj_2022” (de la dimensión dinámica “Años”).

  • Case
    • When InString(Producto.currentmember.member_name,”01”) = 4 then 100
    • When InString(Producto.currentmember.member_name,”01”) = 5 then 120
    • When InString(Producto.currentmember.member_name,”01”) = 6 then 140
    • Else 160
  • End

Asigna los siguientes valores:

Cualquier consulta envía, por favor, un correo a: essbaseeasy@gmail.com

Anuncio publicitario