# PutTaskTableSelection

Overrides the list of tables selected for inclusion in a specific Replicate task.

## Required user role

See [Required Enterprise Manager permissions](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/Introduction/AEMPermissions.htm).

## Syntax

`public void PutTaskTableSelection(` ` TableSelectionDefinition payload,  ` ` string server,  ` `string task` `)`

## Call parameters

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| payload | TableSelectionDefinition | A class containing the table selection definitions as a payload. See the example below. |
| server | string | The Replicate Server name as defined on Qlik Enterprise Manager.<br><br>Example: myrepsrv1 |
| task | string | The Replicate task for which to change the selected tables. |

## Payload attributes

The following attributes can be included in the payload:

* List&lt;TableSelection&gt; IncludedPattern: Tables matching this pattern will be included.
* List&lt;TableSelection&gt; ExcludedPattern: Tables matching this pattern will be excluded.
* List&lt;TableSelection&gt; ExplicitIncludedTables: Tables matching this name will be included.

## Payload class

The following are part of the TableSelection class:

* Owner (string): The table schema or owner
* Name (string): Tables to include or exclude according to the attribute: IncludedPattern, ExcludedPattern, or ExplicitIncludedTables
* LoadOrder (long): The order in which the tables will be loaded to the target. "0" means random order. See [Load order](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Load_order) for additional enums that can be used to define the load order. You can also set the value to StandardLoadOrder.LOWEST, StandardLoadOrder.LOW, StandardLoadOrder.NORMAL, StandardLoadOrder.HIGH, or StandardLoadOrder.HIGHEST.
* TableType (TableType): The entity type. Can be view or table.

## Example payload

```
var tableSelectionDefinition = new TableSelectionDefinition
{
	IncludedPattern = new List<TableSelection>
	{
	 new TableSelection
	 {
	   Owner = "schema%",
	   Name="ab%yz%",
	   LoadOrder = (int)StandardLoadOrder.LOWEST
	 }
	},
	 ExcludedPattern = new List<TableSelection>
	 {
	  new TableSelection
	  {
		Owner = "schema3",
		Name="abcd%",
	  }
	 },
	 ExplicitIncludedTables = new List<TableSelection>
	 {
	 new TableSelection
	 {
	  Owner = "schema1",
	  Name = "tbl1",
	 },
	 new TableSelection
	 {
	  Owner = "schema1",
	  Name = "view1",
	  LoadOrder = (int)StandardLoadOrder.HIGH,
	  TableType = TableType.VIEW
	 }
    }
};
_client.PutTaskTableSelection(tableSelectionDefinition, "server1", "task1");
```

## Errors

All of the [general errors](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/error_handling.htm) as well as the errors listed in the table below.

Error responses

| HTTP Code | Enterprise Manager Code | Text | Description |
| --- | --- | --- | --- |
| 500 | AEM\_TASK\_NOT\_FOUND | Replicate task {task} on server {server} could not be found. | The task name is unknown to Enterprise Manager. |