Revision as of 01:59, 4 March 2017 by Lchrisman (talk | contribs) (Created page with "category:Analytica 5.0 category:Cell format functions == CellComparisonFormat( fmt'', var, header'' ) == When a result table is showing exogenous XY_Comparison|Com...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

CellComparisonFormat( fmt, var, header )

When a result table is showing exogenous Comparison Variables in separate columns, the CellComparisonFormat predicate must be used if you want to control which columns your cell format «fmt» applies to. Without the use of this predicate, your formats will usually apply to all columns, except in the case where your format varies by the Comparison Index, in which case it won't apply to the columns for your exogenous variables at all.

This is used in your Computed cell formats, in the Cell Format Expression attribute. See Computed cell formats for an overview. This function addresses a rare situation that you will probably seldom (if ever) need to worry about.


  • «fmt»: A cell format predicate, or an expression that computes a cell format.
  • «var»: The Comparison variable, or expression, that the format applies to, or Self if it should apply exclusively to the main value's columns. When this is omitted, «fmt» applies to all Comparison variable columns, but not to the main value's columns.
  • «header»: Boolean. Controls whether «fmt» applies to the header cell, body cells only, or both header and body cells.

Comparison variables

A comparison variable is a variable elsewhere in your model, that has been added to your result view. These are added by using the XY comparison dialog, and are useful for comparing variables and producing complex plots such as X-Y graphs or bubble charts that compare multiple results. The following shows a result table for variable Y that includes the result of variable X in the same table. X here is called the Comparison variable.

CellComparisonFormat XY.png

When you create your own Computed cell formats for variable Y, they most likely apply only to the Y columns. For example, consider this heat map.

CellFill( If Self<0 Then 'Red' Else 'Green', Abs(Self) )

:CellComparisonFormat BadHeatMap.png

The colors only reflect the values of Y, even though they appear in all columns. This should not be surprising, since the computed format only made use of Y's values and not X's. To restrict the heat to Y's column, you need to use CellComparisonFormat.

CellComparisonFormat( CellFill( If Self<0 Then 'Red' Else 'Green', Abs(Self) ), Self )

:CellComparisonFormat YHeatMap.png

To also include X's heatmap, the values of X must be processed as well.

     CellComparisonFormat( CellFill( If X<0 Then 'Red' Else 'Green', Abs(X) ), X ),
     CellComparisonFormat( CellFill( If Self<0 Then 'Red' Else 'Green', Abs(Self) ), Self )

:CellComparisonFormat XYHeatMap.png

See Also


You are not allowed to post comments.