# 1 Single value channel

Single values channel are created to display one and only one value and/or a simple graphic.

## 1.1 General setup

Choose "Single value" in the layout options to make your channel a single value channel.

Use an SQL statement that fetches one and only one data row. The data row may have more than one column.

• To display a Value: the channel will use the first column with a value and with a range defined; if no range is set for any output field, it will get the first column with a value.
• To display a simple graphic: the channel will use the first column with a struct.

## 1.2 Basic version (Simple value)

SQL statement:

The example above produces the following channel:

The € symbol is being set as attribute, through the via standard column attributes (Dictionary / Physical / Attributes):

## 1.3 Colors based on values

### 1.3.1 Based on displayed value

Background and foreground colors of the channel can be set using the value ranges. Below there is a simple example about how these changes are made, changes that directly depend on the displayed value.

To define colors according to the values range on the table, it will be necessary to define them through the table colorizer option, which must be accessed through the menu Dictionary/Physical/Attributes/Table colorized.

In this case, the color palette is defined as displayed in the following picture:

And the result obtained is this colored channel based on the value range:

### 1.3.2 Based on another value

Background and foreground colors can also be set by a hidden value. To this end, it is necessary to request a second column in the SQL query.

In this example, the previous range parameters have been set to the new 'cost' column.

As a result the value displayed corresponds to the 'cost' column, but its color depends on the 'sales' current value.

## 1.4 Single graphics

For this example it is used the 'Aggregate sales fact' table model.

Single graphics are created from structs SQL Statements. Check how they work here.

SQL statement:

Channels with only a simple graph can not define ranges.The example above produces the following channel:

## 1.5 Single value + Single graphic

Both renders can be displayed at the same time. The label displayed as a title will be the value column label.

SQL statement:

Ranges can also be defined with this channels. The example above produces the following channel:

## 1.6 Market graphs

As explained above, the structs are used to create SVG graphs that can be displayed inside the single values channels and in other places like channel tables.

Single value channel can also read another struct definition to render the market results, or at least to display as if they where from the market.

Here you can see how this graph has been created.

Note that the struct in the SQL will have the following structure:

#### STRUCT

row('b_stock', percent, leftValue, rightValue)

Bold text is required, the other is optional

leftValue and rightValue are optional, but we must define either both or none.

When only the percentage is defined the result will be like the following:

Some properties might be added in order to make this channel more customizable: this attributes are added after the 'b_stock' separed by spaces.

Properties:

1. upIsBad: Switch the colors between good and bad colors.
2. bad_XXXXXX: Change the color when "bad", the 'XXXXXX' is the HEX code of the new color.
3. good_XXXXXX: Change the color when "good", the 'XXXXXX' is the HEX code of the new color.

So at the end the row might look something like this:
row('b_stock upIsBad bad_000000 good_FF00FF', percent, leftValue, rightValue)

More detailed info about single value structs can be found in this Section: Development/Views/View utils/Struct views.