Difference between revisions of "Custom Field Type: Special – Calculated Value"

From SmartWiki
Jump to: navigation, search
(See Also)
(See Also)
Line 92: Line 92:
 
===See Also===
 
===See Also===
 
[[How Calculated Custom Fields Work]]
 
[[How Calculated Custom Fields Work]]
 +
 
[[Template Formulas]]
 
[[Template Formulas]]

Revision as of 18:04, 9 April 2009

General Description

Executes an expression to calculate a value and store the result.

Field Options

  • Allow Empty: N/A
  • Default Text: N/A
  • Options: Expression
  • Track Changes: Yes
  • Store To Value: N/A

Special Options for Field

Expression – defines the expression to be executed.

All values are treated as strings. For arithmetic operations, PARSEINT and PARSEFLOAT functions are used to convert the string value to a numeric value.

Example summing the values using five custom fields:

ParseFloat([Total Monthly Cost]) + ParseFloat([Total Cost Ex]) + ParseFloat([Hardware Rental]) + ParseFloat([Email]) + ParseFloat([Other])

If you are using this field in a "Dynamic Control Field" address the fields by thier field ids with the following syntax:
  frm.cf_customfieldid.value 

Example: PARSEFLOAT(frm.cf_1254625.value)*0.44

Field Validation

  • Type: N/A
  • JavaScript Validation: N/A
  • Message: N/A
  • HTML Tag: N/A

Field Formatting Options

  • Height: N/A Measure: Default:
  • Width: N/A Measure: Default:
  • Number Format: Yes
  • Style: Yes
  • Tool Tip: Yes

Notes

You can use arithmetic, string, comparison operators and functions within the calculated custom field.

  • References to other fields are always enclosed in square brackets: [variable1]
  • The calculations are performed when you click the Save button and save the page.

Important Notes on Calculation Order

  • Calculated field formulas are executed in the same order that the calculated fields are displayed on the page.
  • You must not place fields that perform summary calculations based on other calculated fields ABOVE the subordinate calculations.
  • If the fields are ordered in this manner, saving the page will not update the summary calculation, as summary formula will be executed BEFORE the subordinate calculations are performed.

SmartSimple Calculated Field Operators

Arithmetic Operators

CS08.png

String Operators

CS081.png

Comparison Operators

CS084.png

Date Functions

CS085.png

Time Functions

To calculate the time difference for Standard Fields in hours and minutes use the following

Level 1:

  • timediff(frm.ostartdate.value,frm.oenddate.value,frm.ostarthour.value,frm.ostartminute.value,frm.oendhour.value,frm.oendminute.value)

Level 2:

  • timediff(frm.startdate.value,frm.enddate.value,frm.starthour.value,frm.startminute.value,frm.endhour.value,frm.endminute.value)

(note: the starttime and endtime Standard Fields are actually stored as part of the startdate and enddate fields, which is why they are used here)

Other Functions

CS086.png

See Also

How Calculated Custom Fields Work

Template Formulas