iThoughts can perform various 'collective' calculations - such as SUM and AVERAGE etc. A little like Excel :-)

See below for an example map where there are a number of items, each with a dollar value. Those items are then sum'd and average'd in the central topic. This works down multiple levels as can be seen with the 'Others' topic which sums its children - the value for which is then included in the calculations further up the branch.

The concepts are FUNCTIONS and VALUES. In the following diagram we can see the VALUES (in green boxes) and the FUNCTIONS (in red boxes)

*NB: This is a 'photoshopped' diagram - normally you can only see the FUNCTIONS when editing the text - the rest of the time, you only see what the function evaluates to.*

## Values

Values are entered directly into the topic text. You know it's a value because it has an = before it. The value is alway a 'decimal' number - but you can include other symbols to make it easier to read. The following all equate the the same value of 1.23

- =1.23
- =$1.23
- =USD1.23
- =sausages1.23

*IMPORTANT: Notice how there is a SPACE before the equals sign. This is very important as you'll read later on in the 'advanced' section.*

## FUNCTIONS

Functions are also entered directly into the topic text - but they are automatically 'substituted' for the value they evaluate to. Functions act on the VALUES of their immediate children. Typical uses would be to sum or average the child values. You know it's a function because it starts with one of the following

- =sum
- =count
- =average
- =min
- =max
- =median
- =mode

## Advanced

Much of the time, the above will be sufficient - but there's more. The following map has multiple VALUES in each topic (in this case 'time' and 'cost'.) Question is, how can we SUM them individually?

...this is where the concept of a VARIABLE comes in. Variables are like algebra at school - you assign a number to a 'named variable' (for example x=1) then later on you can refer to that variable in some other function. In the example above, we have 2 variables 'cost' and 'time' and they are assigned values in the 'Job' topics. Then, in the root topic, they are individually sum'd.

See below for the functions/values as entered in the topic text - again FUNCTIONS are in red and VALUES are in green.

What we can see above (starting in the bottom right corner) is:

- Sub Job1 and Sub Job2 assign VALUES of 4 and 3 respectively to a 'subtime' VARIABLE.
- Job4 has a FUNCTION that will sum the 'subtime' VARIABLE of its children and assign the result to a 'time' VARIABLE.
- The Central topic has 4 functions - one of which will sum the values of the 'time' variables of its children.

*NB: in the above we can also see :0 after some of the functions. This tells the system how many decimal places to display (the default is 2)*

## Advanceder (is that a word?)

OK, so we can now have multiple VALUES in each topic and sum, average, count them etc. But I know what you're thinking - can I then multiply some of the results together? Good question - take a look at the following map - notice how we have combined the hours for ProjectA and B (22+18=40) and then we figured out the percentage of time spent on each one - cool huh!

There is one final concept to understand - the FORMULAE. Formulae will allow you to do basic math using the VARIABLES previously created. For example, you could add together the result of sum(projectA) and sum(projectB) to get the total time spent on both projects.

You can identify formulae because they start with = and are encapsulated in square brackets []

See below for the functions/variables/formulae (formulae in blue this time)

In the above we can see:

- Monday-Friday topics assign time VALUES to the projectA and projectB VARIABLES.
- The sum of projectA and projectB VARIABLES (for the immediate children) are calculated and assigned to variables called a and b respectively.
- A new variable t is assigned to the value of a + b (i.e. the sum total of project a and b)
- a divided by t and multiplied by 100 is calculated (i.e. the percentage)

## Summary

Four basic concepts:

- VALUES (numbers)
- FUNCTIONS (things that act on the VALUES of child topics - sum, average etc)
- VARIABLES (place holders for VALUES so they can be referenced elsewhere)
- FORMULAE (maths stuff that evaluates the VALUES referenced by the VARIABLES)

VALUES are displayed 'as is' in the topic text, whereas FUNCTIONS and FORMULAE are substituted for their evaluated values.

### VALUE syntax

VARNAME=NUMBER

VARNAME is optional and represents the name of a variable to assign the number to.

*NB: The number can have 'stuff' either side of it to give it more 'context' (e.g. $, £, hours etc. etc.)*

### FUNCTION syntax

VARNAME1=method(VARNAME2):DECIMAL

VARNAME1 is optional and represents the name of a variable to assign the result of the function to.

method is the action to take (sum, average, min, max, median, mode, count)

VARNAME2 is optional and represents the name of a variable in the child topics to apply the method to.

DECIMAL is optional and represents the number of decimal places to display (default is 2)

### FORMULAE syntax

VARNAME=[mathstuff]:DECIMAL

VARNAME is optional and represents the name of a variable to assign the result of the mathstuff to.

mathstuff is the actual 'math stuff' (for example a + b)

DECIMAL is optional and represents the number of decimal places to display (default is 2)