Custom field of the task may have one of the following types:
- Integer
- String
- Date
- Time
- Date & Time
- List
- Currency
- Float
- Duration
To create a new task custom field use following steps:
- Select main menu command [Tools -> Custom fields…] .
-
Click on "New" button on "Edit custom fields" dialog toolbar or press "Ins" key.
-
In "Edit Custom Field" dialog enter field title, code and select its type from "Type" drop-down list. By default custom field"s code will contain "cf_" prefix and custom field title, for example custom field "Total" will have "cf_Total" code. Code is a unique identifier that is required for further calls to this custom field.
Be careful while assigning custom field type. After you click "Ok" you won"t be able to change it.
There are two ways of filling task custom field: its value can be entered by user and alternatively it can be calculated by some other task attributes and fields that were defined and assigned earlier. If custom field is calculated automatically, it can"t be entered by user and vice versa.
How to programme formula
Formula is described in "Formula" entry field. Variables and functions that are used in formula must begin with "$" symbol. Formula may include adding, subtraction, multiplication, division, exponentiation, type conversion functions and "if" statement.
Following table contains the operations that are available in formula:
Operation |
Description |
+ |
Summation |
- |
Difference |
* |
Multiplication |
/ |
Division |
^ |
Exponentiation |
and |
The result of this operation is true if both operands are true |
or |
The result of this operation is true if at least one of the operands is true |
= |
Equal |
< |
Less |
<= |
Less or equal |
> |
Greater |
>= |
Greater or equal |
Examples:
- If you want to programme expression you should write 25^3.
- The result of the expression (25+10>30) or (5*3<15) is true.
- The result of the expression (45/9>6) and (12-3=9) is false.
While carrying out any arithmetic operations, pay attention to their types and the type of obtained result. For example you can"t multiply two variables one of which has "date" type and other is integer. Or it"s impossible to assign float variable to the field with "time" type. All formula"s elements must have the same type.
There are special functions to convert the variable of one type to another:
Function |
Description |
ToInteger |
Convert any type variable to integer |
ToFloat |
Convert any type variable to real number |
ToDate |
Convert any type variable to date format |
ToTime |
Convert any type variable to time format |
ToDateTime |
Convert any type variable to date & time format |
ToString |
Convert any type variable to string |
If the argument of the function can"t be converted to required type, the result of this function work will be undefined or user will receive error message.
Note: When string variable is used in formula, it should be written in double quotes.
For example, if you want to sum up integer 41 and string "12", you need to write 41+ToInteger("12").
The syntax of "if" statement is following:
iif(parameter1, parameter2, parameter3)
- parameter1 is any logical expression which result can be only true or false;
- parameter2 is the value, formula or logical expression that will be assigned to this custom field if first parameter is true;
- parameter3 is the value, formula or logical expression that will be assigned to this custom field if first parameter returns false.
Types of the second and third parameters must be the same as current custom field type.
Enter custom field default value in accordance with its type into "Default value" field.
You can set format for custom field values and their unit by using "Display format" field. For example, if you want to display custom field value to three decimal digits and its unit is USD, you should enter #0.000 USD. Custom field value will have only one decimal digit and EUR unit if display format is #0.0 EUR.
Check corresponding options if you want this field to be filtered, grouped, active or necessary while creating a task and click "Ok".
To edit custom field select it and click on "Edit" button on "Edit custom fields" dialog toolbar or press "F4" key.
To delete custom field select it and click on "Delete" button on "Edit custom fields" dialog toolbar or press "Del" key.
To move custom field select it and click on "Move Up" / "Move Down" buttons on "Edit custom fields" dialog toolbar.
|