Como ya sabemos el formato condicional en los indicadores, es una propiedad que alerta a los usuarios sobre el estado de sus negocios. ¿Pero qué pasa cuando queremos aplicarlo en una Crosstab de Design Studio cuando el Data Source es HANA?
Cuando el Data Source es HANA, ésta funcionalidad no está disponible y tenemos que buscar una alternativa que nos permita solucionar éste problema. Se podría realizar con el componente Scorecard, pero en Clariba hemos encontrado una solución para realizarlo con Crosstab que és más eficiente puesto que tiene mejor rendimiento ante la Scorecard. Además, la solución es fácil de mantener y escalable. En éste blog te mostraremos cómo lo hemos logrado.
Los componentes que vamos a utilizar son:
- Crosstab
- Text
- Rapid Prototyping (parte de una extensión)
Paso 1: instalación de la extensión
We need to install an extension to be able to add the Rapid Prototyping component to Design Studio. This component will allow us to write Javascript to read indicators from the crosstab and apply alerts. You can download the extension HERE
Select the .zip option:
From within Design Studio, select Tools - Install Extension to Design Studio…
Buscamos el archivo .zip que acabamos de descargar y hacemos clic en Aceptar
Once installed locally, install it in the platform by selecting Tools - Platform Extensions…
Select the extension going to be used: Design Studio SCN Community Prototypes, and click on “Install on Platform”
Cerramos la ventana; La extensión ya se ha instalado.
Paso 2 - Desarrollo
The first step is preparing the data source. To do so, we must create a column for each one of the measures we want to create an alert for. We will insert an indicator in each column, allowing us to check which kind of alert we are applying on it. For example:
• 1 for those values to be highlighted in RED
• 2 for those values to be highlighted in GREEN
Right after, we create the crosstab pointing to that data source. We must also create a text element where we will show the crosstab name, and finally the Rapid Prototype component. We will end up with these components:
��
We have to modify the crosstab’s CSS Style in order to hide all columns where alerts are allocated. We do not want these columns to be displayed, but we will need them in the HTML code to retrieve their values. You can find a good explanation on how to format a crosstab in the Clariba Blog article: Formatting Crosstabs
Our JavaScript code will allow us to perform the following tasks:
• Retrieving the table name we want to apply the alert to (defined at the CROSS_ID text component we’ve created before)
• Getting the JS crosstab object using this Name
• Using the JS object, we’ll be able to browse across all crosstab’s child records. Following the fist example, in case the child where the alert is 1, we’ll change the style.color from the indicator to RED. In case the value is 2, we’ll change it to GREEN
¡Observa los resultados a continuación!
Paso 3 - Replicación
Finalmente, si tenemos más de una Crosstab en la que queramos aplicar alertas en el mismo Documento de Design Studio, es tan facil como hacer un set.Text(“Nombre_Crosstab”) al componente de texto creado (CROSS_ID).
(No dude en ponerse en contacto con nuestro equipo para cualquier consulta!)
