Difference between revisions of "Formula Fields"

From AgileApps Support Wiki
imported>Aeric
m (Text replace - 'Setup > Customize > ' to 'Designer > Data & Presentation > ')
 
imported>Aeric
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
A ''formula field'' is a field that contains a formula (as distinct from a field that is used ''in'' a formula). Formula Fields provide the ability to calculate dynamic values using [[Expressions]] and standard [[Formula Functions|Functions]]. Formula Fields are added to [[Objects]] via [[Form Layout|Form Layouts]].
A ''formula field'' is a field that contains a formula (as distinct from a field that is used ''in'' a formula). Formula Fields provide the ability to calculate dynamic values using [[Formula Expressions]] and standard [[Formula Functions]]. Formula Fields are added to [[Objects]] using [[Form|Forms]].


==Examples==
==Examples==
Typical formula examples include the following calculations:
Typical formula examples include the following calculations:
*calculate the number of days Past Due on an invoice record
:*calculate the number of days Past Due on an invoice record
*calculate a discount price (-5%) on orders over $1000
:*calculate a discount price (-5%) on orders over $1000
*create logical tests, such as: was this record created last year? last month?
:*create logical tests, such as: was this record created last year? last month?
*determine if a record is new, or changed from a prior value
:*determine if a record is new, or changed from a prior value


For detailed examples and sample formulas, see [[Expressions]].
For detailed examples and sample formulas, see [[Formula Expressions]].


==To Add or Edit a Formula Field==
==To Add or Edit a Formula Field==
#Click '''Designer > Data & Presentation > Object > {object} > Fields'''
#Click '''[[File:GearIcon.png]] > Customization > Objects > {object} > Fields'''
#Click the [Add Field] button
#Click the '''[Add Field]''' button
#Choose a Field Type: Formula
#Specify the '''Label''' that will appear when the field is displayed.
#;Name/Label/Title:Name of the field
#Choose a '''Display Type''': ''Formula''
#;Return Type:Optionally, choose a [[Return Type]]
#Specify the '''Formula [[Return Type]]'''
#Write an [[Expressions|Expression]] in the formula
#: Additional options may appear, depending on the type of value you select.
#;Fields:Choose a field from the list of available fields
#'''Recalculate Formula Field Value''':
#;Operators:
#:This option causes the value of the field to be calculated for every record in the object when the new or modified formula is saved. Otherwise, values in existing records remain unchanged. (The recalculation happens this one time, only. The checkbox is then cleared so that you never inadvertently make a change to existing records.)
#:Optionally, choose an [[Operators in Formula Expressions|Operator]] to build the expression
#Use the [[Formula Builder]] to create the expression.
#;Formula Functions:Choose from a list of available [[:Category:Formula Functions|Functions]]
#{{:Check Syntax}}
#{{:Check Syntax}}
#;Field Name:The name used to access the field value programmatically. The name is automatically generated from the label you entered. Modify it here, if desired.
#Click '''[Save]''' to insert the formula field into the form layout.<br/> Each record in this object now includes this formula field.
#Click '''[Save]''' to insert the formula field into the form layout.<br/> Each record in this object now includes this formula field.



Latest revision as of 20:57, 8 May 2014

A formula field is a field that contains a formula (as distinct from a field that is used in a formula). Formula Fields provide the ability to calculate dynamic values using Formula Expressions and standard Formula Functions. Formula Fields are added to Objects using Forms.

Examples

Typical formula examples include the following calculations:

  • calculate the number of days Past Due on an invoice record
  • calculate a discount price (-5%) on orders over $1000
  • create logical tests, such as: was this record created last year? last month?
  • determine if a record is new, or changed from a prior value

For detailed examples and sample formulas, see Formula Expressions.

To Add or Edit a Formula Field

  1. Click GearIcon.png > Customization > Objects > {object} > Fields
  2. Click the [Add Field] button
  3. Specify the Label that will appear when the field is displayed.
  4. Choose a Display Type: Formula
  5. Specify the Formula Return Type
    Additional options may appear, depending on the type of value you select.
  6. Recalculate Formula Field Value:
    This option causes the value of the field to be calculated for every record in the object when the new or modified formula is saved. Otherwise, values in existing records remain unchanged. (The recalculation happens this one time, only. The checkbox is then cleared so that you never inadvertently make a change to existing records.)
  7. Use the Formula Builder to create the expression.
  8. Click the [Check Syntax] button to ensure that you have created a valid expression. If you receive an error message, review the content and revise the expression to correct the problems.
    Field Name
    The name used to access the field value programmatically. The name is automatically generated from the label you entered. Modify it here, if desired.
  9. Click [Save] to insert the formula field into the form layout.
    Each record in this object now includes this formula field.

When the appropriate values are entered in the formula fields, the record will display the results dynamically.