KX Dashboards Conditional Highlight on Text

https://learninghub.kx.com/forums/topic/kx-dashboards-conditional-highlight-on-text

I have a dashboard with a text widget which will display a message depending on the state of the data. This uses a query mapper to map to the "Formatted Text" view state.

Example
1. "ERROR: Missing Data"
2. "WARNING: Last load 2024.08.12"

3. "Data up to date"

Can I update my text widget to have conditional formatting such that if its like "ERROR" highlight the text red, if its "WARNING", highlight orange, else green?

:(

If the data source looks like:

([] kkey: enlist`message; vvalue: 1?("ERROR: Missing Data"; "WARNING: Last load 2024.08.12";"Data up to date"))

 

I can use this template (with handlebars helper “occurrences”)

 

{{#if (occurrences this.0.vvalue "ERROR")}}

   {{this.0.vvalue}}

{{else}}

   {{#if (occurrences this.0.vvalue "WARNING")}}

      {{this.0.vvalue}}

   {{else}}

      {{this.0.vvalue}}

   {{/if}}

{{/if}}

 

In this case, query mapping is not necessary.

 

Sorry for the code formatting.., unpack the zip file and import the xml into your environment for the demo.

Worked like a charm, thanks ivankk

One thing though, the only way to get it to reset the value on change is to have it polling and keyed on kkey. Is there a way to "force reset" on a static query?