Hey,
You can use the below steps :
1) define a variable
2) using lookup file, you would get the table name that would be used for FOR each iteration
3) within foreach , use set variable activity and set it to 01-01-2019 if the table name is the one that you needs to be filtered else assign it as 01-01-1900
4) within copy activity
use the below logic :
select * from tablename where date> variablename
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "ForEach1",
"type": "ForEach",
"dependsOn": [
{
"activity": "Set variable2",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "@split(pipeline().parameters.lookup,',' )",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Set variable1",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "delta",
"value": {
"value": "@if(equals(item(),'abc'), '2022-01-01','1900-01-01')",
"type": "Expression"
}
}
},
{
"name": "Wait1",
"type": "Wait",
"dependsOn": [
{
"activity": "Set variable1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"waitTimeInSeconds": 1
}
}
]
}
},
{
"name": "Set variable2",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "test",
"value": {
"value": "@split(pipeline().parameters.lookup,',' )",
"type": "Expression"
}
}
}
],
"parameters": {
"lookup": {
"type": "string",
"defaultValue": "abc,def"
}
},
"variables": {
"delta": {
"type": "String"
},
"test": {
"type": "Array"
}
},
"annotations": []
}
}
Latest one (for any tables)
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "ForEach1",
"type": "ForEach",
"dependsOn": [
{
"activity": "Set variable2",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "@split(pipeline().parameters.lookup,',' )",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Set variable1",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "delta",
"value": {
"value": "@if(equals(item(),'abc'), concat('Select * from ',item(),' where date>=''01-01-2019'''),concat('Select * from ',item()))",
"type": "Expression"
}
}
},
{
"name": "Wait1",
"type": "Wait",
"dependsOn": [
{
"activity": "Set variable1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"waitTimeInSeconds": 1
}
}
]
}
},
{
"name": "Set variable2",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "test",
"value": {
"value": "@split(pipeline().parameters.lookup,',' )",
"type": "Expression"
}
}
}
],
"parameters": {
"lookup": {
"type": "string",
"defaultValue": "abc,def"
}
},
"variables": {
"delta": {
"type": "String"
},
"test": {
"type": "Array"
}
},
"annotations": []
}
}