Conditions

In TeamDesk, there are several functions used to express conditions. In this topic, you will find descriptions of two functions that are commonly used for this purpose: the If and Case functions.

If-Condition

This type of condition works similarly to various programming languages: if the specified condition is true, one statement is executed; otherwise, another statement is executed. The form of the If function in TeamDesk is as follows:

If(conditional1, result1, condition2, result2, ..., conditionalN, resultN, else-result)

The first argument is the condition statement that should answer the Yes/No question (i.e., the condition can only be true or false). The first and second function arguments go in pairs; these are the condition-result statements used to define what condition is set and what result should occur if the condition is true. For example, the If([Project Budget] > 1,000,000, "VIP") formula states that if the project budget exceeds $1,000,000, its type should be changed to VIP.

One If function may contain an unlimited number of condition-result pairs: all the conditions will be verified one by one until one of them is found to be true.

The final argument is the else-component. It defines what statement should be executed if none of the specified conditions are true. For example, the If([Client’s Country] = "USA", 10, 50) function used in the "Delivery Cost" column states that the delivery cost for domestic (USA) customers is $10, while for all other cases, a $50 fee is applied.

The else-statement is optional; if you omit this component, then the else-result will be null. In the If([Company Name] = "ABC Inc.", true) function used for a "Black List" column, a condition may be set to blacklist all leads coming from the ABC Inc. company, while in all other cases, lead records are not affected.

When creating condition statements, make sure that the result- and else-statements produce the same type of data and that the result correlates with the column type.

Case-Condition

This type of function is very similar to the If function but is used to check conditions against multiple cases. Using multiple conditions in the If function requires repeating the same value several times.

For example:

If([Client’s Country] = "USA", 10, [Client’s Country] = "Canada", 20, [Client’s Country] = "Ukraine", 30)

To avoid this repetition, you can use the Case function, which has the following form:

Case(expression, value1, result1, value2, result2, ..., valueN, resultN, else-result)

Here, you state the condition (the first part of it) only once and then enter the condition-verified value and the result. Again, the number of condition value-result pairs is unlimited. During the calculation process, the system checks whether the first conditional part equals any of the defined verified values and produces a corresponding result.

The example above can be written in the following form:

Case([Client’s Country], "USA", 10, "Canada", 20, "Ukraine", 30, 100)

This means that if the client’s country is USA, the rate is 10; if it’s Canada, the rate is 20; if it’s Ukraine, the rate is 30; for all other countries, the rate is 100.