property Column.ComputedField as String
Retrieves or sets a value that indicates the formula of the computed column.

 TypeDescription 
   String A String expression that indicates the formula to compute the field/cell. The formula is applied to all cells in the column with the CellCaptionFormat property on exText ( the exText value is by default ).  
A computed field or cell displays the result of an arithmetic formula that may include operators, variables and constants. By default, the ComputedField property is empty. If the the ComputedField property is empty, the property have no effect. If the ComputedField property is not empty, all cells in the column, that have the CellCaptionFormat property on exText, uses the same formula to display their content. For instance, you can use the CellCaptionFormat property on exHTML, for cells in the column, that need to display other things than column's formula, or you can use the CellCaptionFormat property on exComputedField, to change the formula for a particular cell.

Use the CellCaptionFormat property to change the type for a particular cell. Use the CellCaption property to specify the cell's content. For instance, if the CellCaptionFormat property is exComputedField, the Caption property indicates the formula to compute the cell's content. 

The Def(exCellCaptionFormat) property is changed to exComputedField, each time the ComputeField property is changed to a not empty value. If the ComputedField property is set to an empty string, the Def(exCellCaptionFormat) property is set to exText. Call the Refresh method to force refreshing the control.

The property may include variables, constants, operators or ( ) parenthesis.  A variable is defined as %n, where n is the index of the column ( zero based ). For instance, the %0 indicates the first column, the %1, indicates the second column, and so on.  A constant is a float expression ( for instance, 23.45 ). 

The property supports the following binary arithmetic operators:

The property supports the following unary boolean operators:

The property supports the following binary boolean operators:

The property supports the following binary boolean operators, all these with the same priority 0 :

Obviously, the priority of the operations inside the expression is determined by ( ) parenthesis and the priority for each operator. The property may be a combination of variables, constants and operators.

Samples:

  1. "1", the cell displays 1
  2. "%0 + %1", the cell displays the sum between cells in the first and second columns.
  3. "%0 + %1 - %2", the cell displays the sum between cells in the first and second columns minus the third column.
  4. "(%0 + %1)*0.19", the cell displays the sum between cells in the first and second columns multiplied with 0.19.
  5. "(%0 + %1 + %2)/3", the cell displays the arithmetic average for the first three columns.
  6. "%0 + %1 < %2 + %3", displays 1 if the sum between cells in the first  two columns is less than the sum of third and forth columns


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.