Variables

In a process of work you may need to use one and the same value for different objects of the databse - tables, views, columns, etc. For example, you have an hourly rate value equal to $15. If you need to use this value in formulas of various database objects (in more than one table, view, etc.), you may choose one of the following options:

Imagine that you need to increase the value of your hourly rate from $15 to $18. In the first case you will need to change all formulas manually, which may take a lot of time and effort. If you used the variable, you will need to change its value only once, after what it will be applied to all formulas automatically.

TeamDesk allows you to create new variables to use them later in the system. To add a variable:

Click the Setup link in the top right corner of the window.

Select the Database tab.

Choose Database > Variables in the setup menu. On the displayed page click the New button. The following form will appear on the page:

Variable.gif

In the Name field enter the name of the new variable. In the Value field enter the variable value.

When entering a variable name, make sure that it is unique, that is, it does not coincide with the name of any other variable or the name of any existing table column. In formulas, variables and column references are formatted in the same way - enclosed with square brackets, for example, [Hourly Rate]. If the variable name coincides with the name of any table column, there may occur a reference confusion.

Click Save to add the variable; click Cancel to discard changes.

Variable values are treated by the system as a text. If you need to use variables in the date or numeric format, you will have to convert them into the necessary format later on, when creating formulas.

The following table shows how you should enter text values if you need to convert variables into different formats later on:

Will be converted to format Variable Value
Numeric Enter the number without any additional characters (for example, 10). Use points “.” for decimal fractions (for example, 10.05).
Date Enter the date in the yyyy-mm-dd or mm/dd/yyyy format (for example, 2006/10/28 or 10/28/2006).
Time Enter the time in the hh:mm:ss format (for example, 23:00:40).
Timestamp Enter the timestamp in the yyyy-mm-dd hh:mm:ss format (for example, 2006-10-28 23:00:40).

To edit a variable:

Go to Setup > Database > Variables.

Choose the necessary variable from the list and click Edit in a corresponding table row.

Make necessary modifications to the variable name and value.

Click Save to apply changes.

To delete a variable:

Go to Setup > Database > Variables.

Choose the necessary variable from the list and click Del in a corresponding table row. In the displayed dialog box choose OK to confirm the deletion.