Difference between revisions of "Calculating Information between Levels"
m |
|||
Line 74: | Line 74: | ||
Note: Currently the system doesn't support summing from level 3 to level 1 using a custom field id. The summing would only work with Amount and Duration field. | Note: Currently the system doesn't support summing from level 3 to level 1 using a custom field id. The summing would only work with Amount and Duration field. | ||
+ | |||
+ | |||
+ | ==Using a Level 3 Type Formula== | ||
+ | |||
+ | You can use the Level 3 Type Formula field on the Level 3 Type page in a similar manner as for Level 2. | ||
+ | * The advantage of using a Level 3 Type Formula instead of a Calculated field is that the calculations are done server side, rather than by the browser. | ||
+ | </br> Thus if you are doing a calculation on a value that needs to be populate or calculated on the same Level 3 item it avoids you having to save twice in order to get the final result. | ||
+ | |||
+ | The following example calculates the product of rate times quantity, and saves it in a field called Total with a field ID of 1731330: | ||
+ | '''@l3.#1731330#@=@level3.rate@*@level3.quantity@''' | ||
+ | |||
+ | ''Note: Be sure to use syntax exactly as above.'' | ||
+ | |||
[[Category:Universal Tracking Application]][[Category:Applications]] | [[Category:Universal Tracking Application]][[Category:Applications]] |
Revision as of 16:56, 9 April 2009
If you wish to perform calculations on fields associated with Level 3, but store the results in fields at the Level 2, you use the Level 2 Formula field. You can use any expression and also some built in functions.
When you wish to use multiple template formulas, you must use the semicolon to separate them. For example:
@opportunity.totals@=@#123456#@;@opportunity.quantity@=@654321@
Note: Template formulae will only work if the Template standard field is enabled and visible on the page.
Using a Level 2 Type Formula
In order to use this technique in the current example you will need to first enable the duration field in the Level 2 activity.
1. Click Settings.
2. Click Application Configuration.
3. Click the Activity Settings, Standard Fields link.
4. Enable the Duration field.
5. Click the Save button.
6. Click Settings.
7. Click Activity Settings, Types tab.
8. Click the Addendum type.
9. Scroll to the Level 2 Formula.
10. Enter the following formula:
11. Click the Save button.
This expression will be executed any time a Level 3 item is saved.
12. Click the My Actions tab.
13. Click either Level 3 activity type.
14. Click the Save button.
15. Review the associated Level 2 activity.
- The duration is set to the sum of the durations of the associated Level 3 entities.
- The same technique can be applied to the Level 1 Template formula to sum all the Level 2 durations.
Summing Level 2 to Level 1 using field ID:
Go to level 1 template and use the following format @opportunity.#123456#@=@level2.sum(#987763#)@
Summing Level 3 to Level 2 using field ID:
Go to level 2 template and use the following format @level2.#123456#@=@level3.sum(#678954#)@
Summing Level 3 to Level 2 base on a particular level 3 type:
Go to level 2 template and use the following format @level2.#50235#@=@level3.sum(#50291#):eventtype=8866@ where 50235 is the custom field where you want the value to store in, 50291 is the custom field that you want to sum and 8866 is the level 3 type ID,
Note: Currently the system doesn't support summing from level 3 to level 1 using a custom field id. The summing would only work with Amount and Duration field.
Using a Level 3 Type Formula
You can use the Level 3 Type Formula field on the Level 3 Type page in a similar manner as for Level 2.
- The advantage of using a Level 3 Type Formula instead of a Calculated field is that the calculations are done server side, rather than by the browser.
</br> Thus if you are doing a calculation on a value that needs to be populate or calculated on the same Level 3 item it avoids you having to save twice in order to get the final result.
The following example calculates the product of rate times quantity, and saves it in a field called Total with a field ID of 1731330:
@l3.#1731330#@=@level3.rate@*@level3.quantity@
Note: Be sure to use syntax exactly as above.