# CellIcon

## CellIcon( icon, side )

Displays an image (icon) in a cell, next to a cell value. «icon» is an image. «side» can be 'Right', 'Left' or 'IconOnly'.

This can be used from the Cell Format Expression attribute.

## Examples

The above screenshot uses CellIcon in two ways. First, an icon appears to the right of Staff development, indicating that the projects are sorted in decreasing order by the values in that column, and second, in the Net revenues column to show the the sign of the value. These were implemented using the following code in the Cell Format Expression attribute:

 

CellFormats( CellSpan(Attributes_for_score, CellFormats( If Attributes_for_score=sort_col Then CellIcon( vis_icon,'Right' ), CellOnClick( New_sort_crit(self, ViewMode) ) ), header:true ), If Attributes_for_score='Net revenues' Then CellIcon(If self>0 Then up_icon Else if self<0 Then down_icon, 'Left') )

The first item in the outer CellFormats implements the column sorting. A variable in the model, vis_icon, computes which icon to display (it is defined as If Sort_descending Then icon_descending Else icon_ascending). The model contains logic that sorts the Project index, which is beyond the scope of this discussion. The CellSpan with header:true puts the icon in the header cell.

The second item in the outer CellFormats list implements the green up and red down arrows.

## History

This function was first introduced in Analytica 5.0, but labelled as an experimental feature and not included in expression assist.

In Analytica 5.4, it was exposed on expression assist.

In Analytica 6.0, text in the description calling it experimental was removed.