Difference between revisions of "Computed Fields"

From AgileApps Support Wiki
imported>Alice
(Removed HTML Text type per case 18635)
 
imported>Aeric
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
===About Computed Fields===
Computed fields are user-defined fields that expand analytic capabilities in [[Views]] and [[Reports]]. Without modifying the object model, users can build ''ad hoc'' fields that support complex data modeling and analysis. These fields do not reside in the database, but are created when needed for presentation in Views or Reports.
Computed fields are user-defined fields that expand analytic capabilities in [[Views]] and [[Reports]]. Without modifying the object model, users can build ''ad hoc'' fields that support complex data modeling and analysis. These fields do not reside in the database, but are created when needed for presentation in Views or Reports.


When included in Views or Reports, Computed Fields provide powerful building blocks for analytical models and metrics to monitor business operations in easy-to-read dashboards, tables or charts.
When included in Views or Reports, Computed Fields provide powerful building blocks for analytical models and metrics to monitor business operations in easy-to-read dashboards, tables or charts.


===Eligible Field Types===
====Eligible Field Types====
These field types can be used in Computed Fields formulas:
These field types can be used in Computed Field formulas:
*Text string
:* Text strings (a sequence of alphanumeric characters in quotes)
*Numbers (integers and numbers with decimals)
:* Numbers (integers and numbers with decimals)
*[[Rollup Summary Fields]]
:* [[Rollup Summary Fields]]
*Boolean
:* Boolean (true, false)
*Percent (%)
:* Percent (%)
*Currency
:* Currency


==How it Works==
====Pricing Information Example====
Let's consider a real-life example: an Inventory system where simple details about a product are specified and Computed Fields are used to analyze complex Pricing and Packaging schemes.  
Let's consider a real-life example: an Inventory system where simple details about a product are specified and Computed Fields are used to analyze complex Pricing and Packaging schemes.  


===Pricing Information===
Assume an inventory item, a 6-pack of soda, which is defined as follows:
Assume an inventory item, a 6-pack of soda, which is defined as follows:
:{| border="0" cellpadding="5" cellspacing="0"
:{| border="0" cellpadding="5" cellspacing="0"
Line 24: Line 24:
   Price                      $4.50
   Price                      $4.50
   Number of Units per Pack  6
   Number of Units per Pack  6
   Unit Price                Price / Number of Units per Pack <nowiki>(this is a [[Formula Fields|Formula Field]])</nowiki>
   Unit Price                Price / Number of Units per Pack (a Formula Field)
</pre>
</pre>
|}
|}
::''In this record, the unit price is calculated as $.75 per can of soda ($4.50/6 cans of soda = $.75)''
::''In this record, the unit price is calculated as $.75 per can of soda ($4.50/6 cans of soda = $.75)''


===Analysis===
To setup the pricing analysis, create the following Computed Fields, one for each of the available packaging options. Each package option calculates the Unit Price of the 6-pack of soda, based on packaging.
To setup the pricing analysis, create the following Computed Fields, one for each of the available packaging options. Each package option calculates the Unit Price of the 6-pack of soda, based on packaging.


This [[Expressions|Expression]] is used to calculate the <tt>Unit Price</tt> for each package option: <tt>Unit Price = (Package Price / (Quantity * 6 cans each))</tt>
This [[Formula Expression]] is used to calculate the <tt>Unit Price</tt> for each package option: <tt>Unit Price = (Package Price / (Quantity * 6 cans each))</tt>


:{| border="0" cellpadding="5" cellspacing="0"
:{| border="0" cellpadding="5" cellspacing="0"
|
|
<pre> Computed Fields
<pre> Computed Fields
Line 45: Line 44:
::''With this Analysis, it's easy to compare the unit price of Package Option to the Unit Price of a single 6-pack ($.75).''
::''With this Analysis, it's easy to compare the unit price of Package Option to the Unit Price of a single 6-pack ($.75).''


==Add a Computed Field==
===Working with Computed Fields===
In this example, the Revenue field in the Accounts object is used to create the computed field. The ranges are defined as follows:
 
====Adding a Computed Field====
In this example, the Revenue field in the Accounts object is used to create the computed field. Using a computed field allows records to be grouped by range and displayed in a pie chart.
 
The ranges are defined as follows:
#From the Reports tab, add a new report, or choose a report to modify
#From the Reports tab, add a new report, or choose a report to modify
#From the Fields tab, confirm that an appropriate field is in the list of Selected Fields (in this case, Revenue)
#From the Fields tab, confirm that an appropriate field is in the list of Selected Fields (in this case, Revenue)
#Click the ''New Computed Field'' link
#Click the ''New Computed Field'' link
#:[[Image:Newcomputedfield.gif|none|thumb]]
#Add the following code to create a computed field
#Add the following code to create a computed field
#;Column Title:Name of the computed field
#;Column Title:Name of the computed field
#;Return Type:Select Text
#;Return Type:Select '''Text'''<br>''Note:''<br>The return type is plain text. Rich text with HTML tags is not supported.
#;Formula:Add the following code:
#;Formula:Add the following code:
#:::<tt>IF((REVENUE  <= 10000),'<$10K', </tt><br>
#:::<tt>IF((REVENUE  <= 10000),'<$10K', </tt><br>
Line 60: Line 62:
#:::<tt>IF((REVENUE  >=500000 && REVENUE  <1000000),'$500K - 1M',</tt><br>
#:::<tt>IF((REVENUE  >=500000 && REVENUE  <1000000),'$500K - 1M',</tt><br>
#:::<tt>'>= $1M'))))</tt>
#:::<tt>'>= $1M'))))</tt>
#:[[Image:Computedrevenuerange.gif|none|thumb]]
#From the Group tab, choose the computed field in the ''Group Information by'' field
#From the Group tab, choose the computed field in the ''Group Information by'' field
#From the Charts tab, choose Pie
#From the Charts tab, choose Pie
#Click the [Preview] button to display this chart
#Click the '''[Preview]''' button to display this chart
#:[[Image:revenuepie.gif|none|thumb|In this example, the computed field allows records to be grouped by range, and displayed in a pie chart]]


==Using Computed Fields==
====Using Computed Fields====
Computed fields offer different functionality, depending on whether the computed fields are used in a View or a Report.  
Computed fields offer different functionality, depending on whether the computed fields are used in a View or a Report.  


Line 72: Line 72:


In [[Reports]], computed fields can be used to:
In [[Reports]], computed fields can be used to:
*[[Filters|Filter a Report]]
:*[[Filters|Filter a Report]]
*[[Color Code|Add Color Coding to a Tabular Report]]
:*[[Color Code|Add Color Coding to a Tabular Report]]
*[[Report Group|Group Records to create Matrix Reports]]
:*[[Report Group|Group Records to create Matrix Reports]]
*[[Report Compute|Compute Metrics in Matrixed Reports]]
:*[[Report Compute|Compute Metrics in Matrixed Reports]]
*[[Charts|Enhance Chart Metrics]]
:*[[Charts|Enhance Chart Metrics]]


In [[Views]],  computed fields can be used to:
In [[Views]],  computed fields can be used to:
*[[Filters|Filter a View]]
:*[[Filters|Filter a View]]
*[[Color Code|Add Color Coding to a View]]
<!--
:*[[Color Code|Add Color Coding to a View]]
-->


==Formula Functions used in Computed Fields==
====Formula Functions in Computed Fields====
The following [[Formula Functions]] can be used in Computed Fields:
The following [[Formula Functions]] can be used in Computed Fields:
{| border="1" cellpadding="5" cellspacing="0"
{| border="1" cellpadding="5" cellspacing="0"
Line 143: Line 145:


For details on how to use these functions, see [[Formula Functions]].
For details on how to use these functions, see [[Formula Functions]].
__FORCETOC__

Latest revision as of 23:30, 12 June 2014

About Computed Fields

Computed fields are user-defined fields that expand analytic capabilities in Views and Reports. Without modifying the object model, users can build ad hoc fields that support complex data modeling and analysis. These fields do not reside in the database, but are created when needed for presentation in Views or Reports.

When included in Views or Reports, Computed Fields provide powerful building blocks for analytical models and metrics to monitor business operations in easy-to-read dashboards, tables or charts.

Eligible Field Types

These field types can be used in Computed Field formulas:

  • Text strings (a sequence of alphanumeric characters in quotes)
  • Numbers (integers and numbers with decimals)
  • Rollup Summary Fields
  • Boolean (true, false)
  • Percent (%)
  • Currency

Pricing Information Example

Let's consider a real-life example: an Inventory system where simple details about a product are specified and Computed Fields are used to analyze complex Pricing and Packaging schemes.

Assume an inventory item, a 6-pack of soda, which is defined as follows:

 Field Name:                Value:
   Part Number                Soda-20457
   Description                6 cans, shrink-wrapped, 12 oz each
   Price                      $4.50
   Number of Units per Pack   6
   Unit Price                 Price / Number of Units per Pack (a Formula Field)
In this record, the unit price is calculated as $.75 per can of soda ($4.50/6 cans of soda = $.75)

To setup the pricing analysis, create the following Computed Fields, one for each of the available packaging options. Each package option calculates the Unit Price of the 6-pack of soda, based on packaging.

This Formula Expression is used to calculate the Unit Price for each package option: Unit Price = (Package Price / (Quantity * 6 cans each))

 Computed Fields
   Package Option:     Quantity:   Package Price:    Unit Price:
      Case                   4         $15.              $.625
      Carton                 8         $20.              $.416
      Bulk                  12         $35.              $.486
With this Analysis, it's easy to compare the unit price of Package Option to the Unit Price of a single 6-pack ($.75).

Working with Computed Fields

Adding a Computed Field

In this example, the Revenue field in the Accounts object is used to create the computed field. Using a computed field allows records to be grouped by range and displayed in a pie chart.

The ranges are defined as follows:

  1. From the Reports tab, add a new report, or choose a report to modify
  2. From the Fields tab, confirm that an appropriate field is in the list of Selected Fields (in this case, Revenue)
  3. Click the New Computed Field link
  4. Add the following code to create a computed field
    Column Title
    Name of the computed field
    Return Type
    Select Text
    Note:
    The return type is plain text. Rich text with HTML tags is not supported.
    Formula
    Add the following code:
    IF((REVENUE <= 10000),'<$10K',
    IF((REVENUE >= 10000 && REVENUE < 100000),'$10-100K',
    IF((REVENUE >=100000 && REVENUE < 500000),'$100K-500K',
    IF((REVENUE >=500000 && REVENUE <1000000),'$500K - 1M',
    '>= $1M'))))
  5. From the Group tab, choose the computed field in the Group Information by field
  6. From the Charts tab, choose Pie
  7. Click the [Preview] button to display this chart

Using Computed Fields

Computed fields offer different functionality, depending on whether the computed fields are used in a View or a Report.

Computed fields must be created separately for Views and Reports. A computed field created in a View is not available in a Report, just as a computed field created in a Report is not available in a View.

In Reports, computed fields can be used to:

In Views, computed fields can be used to:

Formula Functions in Computed Fields

The following Formula Functions can be used in Computed Fields:

Date Functions Logical Functions
  • AND
  • IF
  • NOT
  • OR
  • Not included: ISNEW, ISCHANGED, ISNULL
Math Functions Text Functions
  • Not included: PRIORVALUE

For details on how to use these functions, see Formula Functions.