# include

## Overview

The `include` statement is used to combine Transcript task files together

## Syntax

**`include`***`taskfile`*

## Details

The `include` statement is used to combine two or more task files into a single script prior to commencement of execution.

{% hint style="info" %}
If using the Windows path delimiter - `\` - it is advisable to put the path+filename in double quotes to avoid the backslash being interpreted as an escape character
{% endhint %}

Before executing a task file, Transcript analyses the script and processes all the `include` statements. Wherever an `include` statement is encountered, the specified *taskfile* is read from disk and inserted into the script in place of the `include` statement itself.

### Command placement

As with most statements, `include` must occupy a single line of its own in the script.

## Additional notes

The *taskfile* argument is treated as relative to `<basedir>/system/config/transcript/`.

Multiple files may be included in a task file and any included file may include other files but a check is done to ensure that no infinite include loops are generated.

## Example

Given the following two files in `/system/config/transcript/` ...

```
# FILE 1: myscript.trs
option loglevel = DEBUGX

# import usage data from csp
import "system\extracted\AzureCSP\${dataDate}_csp_usage.csv" source CSP alias Usage
default dset csp.usage
rename column resource_id to meter_id

include import_customers.trs

option overwrite = no
set resource_subcategory to Generic
create column interval value individually
create mergedcolumn service_name separator " - " from resource_name resource_subcategory region
# etc ...
```

```
# FILE 2: import_customers.trs
import "system\extracted\AzureCSP\${dataDate}_csp_customers.csv" source CSP alias Customers
rename column CSP.Customers.ID to customer_id
# END FILE 2
```

Prior to execution the pre-processor will combine these into the single memory-resident Transcript task:

```
# FILE 1: myscript.trs
option loglevel = DEBUGX

# import usage data from csp
import "system\extracted\AzureCSP\${dataDate}_csp_usage.csv" source CSP alias Usage
default dset csp.usage
rename column resource_id to meter_id

# FILE 2: import_customers.trs
import "system\extracted\AzureCSP\${dataDate}_csp_customers.csv" source CSP alias Customers
rename column CSP.Customers.ID to customer_id
# END FILE 2

option overwrite = no
set resource_subcategory to Generic
create column interval value individually
create mergedcolumn service_name separator " - " from resource_name resource_subcategory region
# etc ...
```
