MATCH

English (Español a continuación)

This command allows to select in the Report Script those members whose names meet a certain pattern.

Its syntax consists of 2 parts:

  • <MATCH(Part A, Part B)

Part A: “Member” / “Generation” / “Level”: In this part of the command, the name of a member, of a generation or of a level can be included. The search to find members matching the pattern will be performed:

  • Name of a member: the search is made from that member down until its members of level 0.
  • Name of a generation: the search is made among the members of that generation.
  • Name of a level: the search is made among the members of that level.

Part B: Pattern: establishes the conditions that the name of the members must meet to be selected for the Report Script; wildcards can be used:

  • Asterisk “*”: it is placed at the end of the text string and implies that from this sign forward any string of characters would be valid.
  • Question mark » ? “: can be placed anywhere in the text string and means that any character can go in that place.

IF the names are defined as “case-sensitive” this command behaves as “case-sensitive”; otherwise not.

Let’s look at some examples:

a) Suppose the “Markets” dimension includes countries:

  • <MATCH(“Europe”, PO*)

Select all members descended from Europe (including herself) whose names start with “PO”:

  • Portugal
  • Poland

b) Another example:

  • <MATCH(“lev0,Markets”, ?O*}

Select all countries belonging to level 0 of the “Markets” dimension whose names begin with any letter, followed by the letter “O”, and followed by any number of indeterminate characters.

c) Suppose a “Products” dimension with the following members:

  • 45-MAD
  • 35-MAD
  • 80-MAD
  • 33-BY
  • 66-BY

The instruction:

  • <MATCH (Products,”??-MAD”)

Select the products.

  • 45-MAD
  • 35-MAD
  • 80-MAD

There is a command “<MATCHEX”, similar to the previous one, but it includes a third element:

  • <MATCHEX(Part A, Part B, Part C)

Part A: “Member” / “Generation” / “Level”

Part B: Pattern

Part C: ALT / MBR / BOTH

  • That third element (ALT / MBR / BOTH) is optional: if it is not included the default option is applied (selection by names).

Possible options:

  • ALT: the search is performed at the alias level.
  • MBR: the search is performed at the name level.
  • BOTH: the search is performed on both.

Let’s look at an example:

  • <MATCHEX(“Europe”, PO*,BOTH)

These two commands (MATCH / MATCHEX) can also be used inside a conditional structure:

  • <LINK(<MATCH(“Europe”, PO*} AND <UDA(Markets, “Large”))

And these two commands can also be used more than once in the Report Script.

Español

Este comando permite seleccionar en el Report Script aquellos miembros cuyos nombres cumplan determinado patrón.

Su sintaxis consta de 2 partes:

  • <MATCH(Parte A, Parte B)

Parte A: “Miembro” / “Generación” / “Nivel”: En esta parte del comando se puede incluir el nombre de un miembro, de una generación o de un nivel. La búsqueda para encontrar miembros que cumplan el patrón se realizará:

  • Nombre de un miembro: la búsqueda se realiza desde ese miembro hacía abajo hasta llegar a sus miembros de nivel 0.
  • Nombre de una generación: la búsqueda se realiza entre los miembros de esa generación.
  • Nombre de un nivel: la búsqueda se realiza entre los miembros de ese nivel.

Parte B: Patrón: establece las condiciones que deben cumplir el nombre de los miembros para ser seleccionados para el Report Script; se pueden utilizar comodines que se pueden colocar en cualquier lugar de la cadena de texto:

  • Asterisco “ * “: se sitúa al final de la cadena de texto e implica que desde este signo en adelante valdría cualquier cadena de caracteres.
  • Signo de interrogación “ ? “: se puede situar en cualquier lugar de la cadena de texto y significa que en ese lugar puede ir cualquier carácter.

SI los nombres están definidos como “case-sensitive” este comando se comporta como “case-sensitive”; en caso contrario no.

Veamos algunos ejemplos:

a) Supongamos la dimensión “Mercados” que incluye países:

  • <MATCH(“Europa”, PO*)

Selecciona todos los miembros descendientes de Europa (incluida ella misma) cuyos nombres comiencen por “PO”:

  • Portugal
  • Polonia

b) Otro ejemplo:

  • <MATCH(“lev0,Mercados”, ?O*}

Selecciona todos los países que pertenecen al nivel 0 de la dimensión “Mercados” cuyos nombres comiencen por cualquier letra, seguida por la letra “O”, y seguida por cualquier número de caracteres indeterminados.

c) Supongamos una dimensión “Productos” con los siguientes miembros:

  • 45-MAD
  • 35-MAD
  • 80-MAD
  • 33-POR
  • 66-POR

La instrucción:

  • <MATCH (Productos,”??-MAD”)

Selecciona los productos.

  • 45-MAD
  • 35-MAD
  • 80-MAD

Hay un comando similar al anterior “<MATCHEX” pero que incluye un tercer elemento:

  • <MATCHEX(Parte A, Parte B, Parte C)

Parte A: “Miembro” / “Generación” / “Nivel”

Parte B: Patrón

Parte C: ALT / MBR / BOTH

  • Ese tercer elemento (ALT / MBR / BOTH) es opcional: si no se incluye se aplica la opción por defecto que es selección por nombres.

Las opciones posibles:

  • ALT: la búsqueda se realiza a nivel de alias.
  • MBR: la búsqueda se realiza a nivel de nombres.
  • BOTH: la búsqueda se realiza en ambos.

Veamos un ejemplo:

  • <MATCHEX(“Europa”, PO*,BOTH)

Estos dos comandos (MATCH / MATCHEX) también se pueden utilizar dentro de una estructura condicional:

  • <LINK(<MATCH(“Europa”, PO*} AND <UDA(Mercados, “Grande”))

Y también se pueden utilizar en más de una ocasión en el Report Script.

Anuncio publicitario