Changes

Jump to: navigation, search

Template / Type Formula

89 bytes added, 13:28, 26 August 2013
no edit summary
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.
You may also wish to use Template Formulas instead of a [[Custom Field Type: Special – Calculated Value|Calculated Value field ]] because 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 populated or calculated on the same Level 3 item, this will avoid you having to save twice in order to get the final result.
===Counting and Adding Business Days===
Aside from using [[Counting Business Days between Two Dates|Javascript]] to count business days, there are 2 two SmartSimple functions you can use within the L1{{l1}}, L2{{l2}}, and L3 {{l3}} template formula to count and add business days to any Date field.
'''To count the number of business days between 2 two date fields, use the following function:'''
'''SS_FUNC.businessdays('Date1','Date2')'''
This example below calculates the number of business days between the Start Date and End Date.
'''@level1.DateDifference@=SS_FUNC.businessdays('@level1.Startdate@','@level1.Enddate@')'''
 
 
'''To increment a date by a number of business days, use the following function:'''
'''@level1.DateDifference@=SS_FUNC.addbusdays('@level1.Startdate@',5)'''
Note in order to take holidays into considering holidaysconsideration, you will need to create a holiday [[Entering_a_New_Calendar_Event|Holiday Calendar]] and associate this calendar as the holiday calendar within [[Global Settings]].  
==Examples==
* To count the number of ''Companies'' of a certain type assigned to Level 1 , use the following statement in the Level 1 template formula box:
@opportunity.#123456#@="@companies.count(*):rolename='EPS Partner'@";
:''Note: the '''Customer''' field can be be hidden, and will still populate. This is true for all Template/Type formulas.''
* To assign the owner of the company attached to the Level 1 item to the ''Person '' field use the following statement in the Level 1 template formula box:
@opportunity.peopleid@=@company.ownerid@
==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'''.
Go to level 2 template and use the following format @level2.#50235#@=@level3.sum(#50291#):eventtype=8866@
where 50235 is the custom field where in which you want the value to store inbe stored, 50291 is the custom field that you want to sum , and 8866 is the level 3 [[Determining the typeid|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 setting 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 populated or calculated on the same Level 3 item, this will avoid you having to save twice in order to get the final result.
'''@level3.total@=@level3.rate@*@level3.quantity@'''
''or using the fieldid fieldids instead of fieldnamethe field names''
'''@level3.#123100#@=@level3.#123098#@*@level3.#123099#@'''
8,849
edits

Navigation menu