CREATION AND EXECUTION / CREACIÓN Y EJECUCIÓN

English (Español a continuación)

I.- Creation of a Report Script

To create a Report Script, right-click on the database:

  • In the window opened select “Create” / “Report script”.

A text editor opens to develop the Report Script:

  • It has help that allows us to select commands and members that we can use.

Once defined, it must be validated and saved.

We can copy a Report Script within the same database, changing its name (to make some modification), or we can copy it to another database of the same application or another application.

II.- Parts of the Report Script

In a Report Script we can distinguish the following parts:

  • Format commands
  • Sections
    • Title
    • Page
    • Rows
    • Columns
  • Ending

Example:

A Report Script can include several Reports, each with its own structure.

II.A.- Format commands

They are placed at the top and serve to format it.

For example:

  • {PAGELENGTH}: Sets the length of the page.
  • {SETCENTER}: Sets the center position of the page.
  • {SUPMISSINGROWS}: Eliminates from the Report Script those rows in which all the data is missing.
  • {ROWREPEAT}: Repeats the names of the members in all the rows even if they have not changed.

They can be very diverse and are analyzed in different posts of this blog, within the Report Script section.

If a Report Script consists of various Reports, these commands located at the beginning of the Report Script affect all of them, unless different commands are included in the header of one of them.

II.B.- Sections

The Report Script consists of the following sections, although not all of them are mandatory:

  • Title
  • Page
  • Column
  • Row

When defining the Page / Column / Row sections, you must select the dimensions that go in each of them:

  • Not all dimensions have to go in the Report Script.
  • Those dimensions that are not selected will appear in the page header and the data displayed by the Report Script for these dimensions will correspond to the dimension header.

If the name of any dimension contains blank spaces, the name must be enclosed in » «.

a) Title

This section is optional. In the header of the Report Script you can include a title with various information:

  • Name of the Report Script.
  • User who generates it.
  • Database from which it is obtained.
  • Date of elaboration.

To define the title we will use the command {TEXT} that we analyzed in this blog.

b) Page

This section is optional:

  • It is possible to define a Report Script that does not include this section.

Its syntax is:

  • <PAGE(Dimension A, Dimension B, Dimension C…)

This command is used to define the dimensions that go in the header of the Report Script pages.

  • After this command, the members of those dimensions to be displayed are selected.

For example:

  • <PAGE(Markets, Products)
  • Spain, Germany, Italy
  • <DESCENDANTS Products

In this Report Script, two page dimensions have been selected and from each of them the following members:

  • “Markets” Dimension: Spain, Germany, Italy
  • “Products” Dimension: <DESCENDANTS Products

Members of the “Pages” dimensions go at the top of the report, above the column headers.

  • Each time one of these members changes, a new page header is introduced, but does not generate a page break unless the command {PAGEONDIMENSION} has been used.

If multiple page dimensions have been selected, as many page headers are generated as combinations of these members.

  • First, rotate the members of the last selected dimension (the members of the other dimensions remain constant), then rotate the members of the penultimate one, and so on. Finally rotate the members of the first dimension.

On each of these pages, the data shown corresponds exclusively to the members shown in the header.

By default, a new page is started when:

  • Change the member of the page.
  • The structure of the column headers changes.
  • The length of the page was exceeded and the SUPFEED command was not used.
  • The NEWPAGE command is used.
  • The HEADING command is used.
  • The PAGEONDIMENSION command is used, which generates a new page.

c) Rows

This section is required.

the command <ROW is used to define the dimensions to be presented in the Report Script as rows.

Its syntax is:

  • <ROW(Dimension A, Dimension B, Dimension C…)

The order in which the dimensions are included in this command is the order of the row headers in the Report Script.

  • The first row header will correspond to the first dimension, the second header to the second dimension…
  • This order can be modified with the commands ORDER or NAMESCOL.

After this command, the members of those dimensions to be displayed are selected.

For example:

  • <ROW(Sellers, Indicators)
  • <LEV0, Vendors
  • Sales, Expenses, Profits

If no member is selected for some dimension included in the command <ROW, the dimension header will go instead, and the data displayed will correspond to the dimension header.

d) Columns

This section is required.

The command <COLUMN is used to define the dimensions to be presented in the Report Script as columns.

Its syntax is:

  • <COLUMN(Dimension A, Dimension B, Dimension C…)

The order in which the dimensions are included in this command is the order of the column headers in the Report Script.

  • The first line will correspond to the first dimension, the second line to the second dimension…

After this command, the members of these dimensions are selected to be displayed in the Report Script.

For example:

  • <COLUMN(Years, Months)
  • “2018”,”2029”,”2020”
  • <LEV0, Months

If no member is selected for some dimension included in the <COLUMN command, the dimension header will go instead, and the data displayed will correspond to the dimension header.

II.C.- Ending

The Report Script ends with the exclamation mark “ ! “.

  • If this sign is not included when executing it, it does not give an error but no data is obtained.

If a Report Script consists of various Reports (with a specific selection of information and with a specific format), each of them must end with its respective “! “.

III. Execution

To run a Report Script:

  • Click with the right button on the Report Script and in the window opened select “Execute”.
  • You can choose to run it on screen, send it to the printer or generate a file (extension “.rtp” or “.txt”).

We may be interested in the output to be:

  • Formatted, so it can be read.
  • A flat file to load into another database.

Based on this, we will use those format commands that interest us.

Español

I.- Creación de un Report Script

Para crear un Report Script se hace click con el botón derecho sobre la base de datos:

  • En la ventana que se abre se selecciona “Crear” / “Script de informe”.

Se abre un editor de texto para desarrollar el Report Script:

  • Dispone de ayudas que nos permite seleccionar comandos y miembros que podemos utilizar.

Una vez definido se valida y se guarda.

Podemos copiar un Report Script dentro de la misma base de datos, cambiándole el nombre (para hacer alguna modificación), o podemos copiarlo en otra base de datos de la misma aplicación o de otra aplicación.

II.- Partes del Report Script

En un Report Script podemos distinguir las siguientes partes:

  • Comandos de formato
  • Secciones
    • Título
    • Página
    • Filas
    • Columnas
  • Finalización

Ejemplo:

Un Report Script puede incluir varios Reports, cada uno de ello con su propia estructura.

II.A.- Comandos de formato

Se sitúan en la parte superior y sirven para dar formato al mismo.

Por ejemplo:

  • {PAGELENGTH}: Establece la longitud de la página.
  • {SETCENTER}: Fija la posición central de la página.
  • {SUPMISSINGROWS}: Elimina del Report Script aquellas filas en las que todos los datos son missing.
  • {ROWREPEAT}: Repite en todas las filas los nombres de los miembros aunque no hayan cambiado.

Pueden ser muy diversos y se analizan en diferentes entradas de este blog, dentro de la sección de Report Script.

Si un Report Script consta de diversos Reports, estos comandos situados al principio del Report Script afectan a todos ellos, salvo que en la cabecera de alguno de ellos se incluyan otros comandos diferentes.

II.B.- Secciones

El Report Script consta de las siguientes secciones, si bien no todas ellas son obligatorias:

  • Título
  • Página
  • Columna
  • Fila

Al definir las secciones Página / Columna / Fila hay que seleccionar las dimensiones que van en cada una de ellas:

  • No todas las dimensiones tienen que ir en el Report Script.
  • Aquellas dimensiones que no se seleccionen aparecerán en la cabecera de la página y los datos que muestre el Report Script para estas dimensiones corresponderán a la cabecera de la dimensión.

Si el nombre de alguna dimensión contiene espacios en blancos el nombre debe ir entre “ “.

a) Título

Esta sección es opcional. En la cabecera del Report Script se puede incluir un título con diversa información:

  • Nombre del Report Script.
  • Usuario que lo genera.
  • Base de datos de la que se obtiene.
  • Fecha de elaboración.

Para definir el título utilizaremos el comando {TEXT} que analizamos en este blog.

b) Página

Esta sección es opcional:

  • Es posible definir un Report Script que no incluya esta sección.

Su sintaxis es:

  • <PAGE(Dimensión A, Dimensión B, Dimensión C …)

Este comando se utiliza para definir las dimensiones que van en la cabecera de las páginas del Report Script.

  • Tras este comando se seleccionan los miembros de esas dimensiones que se van a mostrar.

Por ejemplo:

  • <PAGE(Mercados, Productos)
  • España, Alemania, Italia
  • <DESCENDANTS Productos

En este Report Script se han seleccionados dos dimensiones de página y de cada una de ellas los siguientes miembros:

  • Dimensión “Mercados”: España, Alemania, Italia
  • Dimensión “Productos”: <DESCENDANTS Productos

Los miembros de las dimensiones “Páginas” van en la parte superior del informe, por encima de las cabeceras de columnas.

  • Cada vez que cambia uno de estos miembros se introduce una nueva cabecera de página, pero no genera un corte de página salvo que se haya utilizado el comando {PAGEONDIMENSION}.

Si se han seleccionado varias dimensiones de página, se generan tantas cabeceras de páginas como combinaciones de estos miembros.

  • Primero van rotando los miembros de la última dimensión seleccionada (los miembros de las otras dimensiones permanecen constantes), luego van rotando los miembros de la penúltima, y así sucesivamente. Por último rotan los miembros de la primera dimensión.

En cada una de estas páginas los datos mostrados corresponden exclusivamente a los miembros mostrados en la cabecera.

Por defecto una nueva página se inicia cuando:

  • Cambia el miembro de la página.
  • La estructura de las cabeceras de columnas cambia.
  • Se supera la longitud de la página y no se ha utilizado el comando SUPFEED.
  • Se utiliza el comando NEWPAGE.
  • Se utiliza el comando HEADING.
  • Se utiliza el comando PAGEONDIMENSION que genera una nueva página.

c) Filas

Esta sección es obligatoria.

se utiliza el comando <ROW para definir las dimensiones que se van a presentar en el Report Script como filas.

Su sintaxis es:

  • <ROW(Dimensión A, Dimensión B, Dimensión C …)

El orden en el que se incluyen las dimensiones en este comando es el orden de las cabeceras de filas en el Report Script.

  • La primera cabecera de fila corresponderá a la primera dimensión, la segunda cabecera a la segunda dimensión…
  • Este orden se puede modificar con los comandos ORDER o NAMESCOL.

Tras este comando se seleccionan los miembros de esas dimensiones que se van a mostrar.

Por ejemplo:

  • <ROW(Vendedores, Indicadores)
  • <LEV0, Vendedores
  • Ventas,Gastos,Beneficios

Si para alguna dimensión recogida en el comando <ROW no se selecciona ningún miembro, en su lugar irá la cabecera de la dimensión y los datos que se muestran corresponderán a la cabecera de la dimensión.

d) Columnas

Esta sección es obligatoria.

Se utiliza el comando <COLUMN para definir las dimensiones que se van a presentar en el Report Script como columnas.

Su sintaxis es:

  • <COLUMN(Dimensión A, Dimensión B, Dimensión C …)

El orden en el que se incluyen las dimensiones en este comando es el orden de las cabeceras de columnas en el Report Script.

  • La primera línea corresponderá a la primera dimensión, la segunda línea a la segunda dimensión…

Tras este comando se seleccionan los miembros de esas dimensiones que se van a mostrar en el Report Script.

Por ejemplo:

  • <COLUMN(Años,  Meses)
  • “2018”,”2029”,”2020”
  • <LEV0, Meses

Si para alguna dimensión recogida en el comando <COLUMN no se selecciona ningún miembro en su lugar irá la cabecera de la dimensión y los datos que se muestran corresponderán a la cabecera de la dimensión.

II.C.- Finalización

El Report Script Finaliza con el signo de exclamación “ ! “.

  • Si no se incluye este signo al ejecutarlo no da error pero no se obtienen datos.

Si un Report Script consta de diversos Reports (con una selección de información determinada y con un formato específico) cada uno de ellos debe finalizar con su respectivo signo “ ! “.

III. Ejecución

Para ejecutar un Report Script:

  • Se hace click con el botón derecho sobre el Report Script y en la ventana que se abre se selecciona “Ejecutar”.
  • Se puede elegir ejecutarlo en pantalla, enviarlo a la impresora o generar un fichero (extensión “.rtp” o “.txt”).

Nos puede interesar que sea una salida:

  • Con formato para que pueda ser leída.
  • Un fichero plano para cargar en otra base de datos.

En función de ello utilizaremos aquellos comandos de formato que nos interesen.

Anuncio publicitario