title: What is the ADF v2 equivalent of WindowStart?
body: <p>We are migrating from ADF V1 to ADF V2. Our pipelines are scheduled to run daily and we have that part of V2 working. A pipeline will start at the appointed time. </p>
  
  <p>My question is how do I pass the time that the scheduled trigger is scheduled to start into the where clause of a select statement in a copy activity? I suspect I've overlooked or misread some documentation, but I just can't figure it out. </p>
  
  <p>No matter what I try, the variable does not seem to evaluate at runtime. So, the where clause looks something like this when it runs:
  where last_update>=’@pipeline().TriggerTime’
  And obviously @pipeline().TriggerTime is not a date.</p>
  
  <p>I’ve pulled this list of parameters to try from <a href="https://docs.microsoft.com/en-us/azure/data-factory/control-flow-system-variables" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/data-factory/control-flow-system-variables</a></p>
  
  <p>This is what worked in V1:
  "sqlReaderQuery": "$$Text.Format('select columns from table where last_update>=\'{0:yyyy-MM-dd}\'', WindowStart, WindowEnd)"</p>
  
  <p>Things I've tried: </p>
  
  <p>-- Passing @trigger().scheduledTime in as a parameter in the trigger to @{formatDateTime(pipeline().parameters.startDate,'yyyy-MM-dd')} in the where clause with a parameter in the pipeline defined as startDate of type string.</p>
  
  <p>-- Setting @pipeline().TriggerTime as the default value for the pipeline().parameters.startDate.</p>
  
  <p>-- Calling @pipeline().TriggerTime in the where clause.</p>
  
  <p>Many thanks in advance.</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <h2>Pipeline Source</h2>
  
  <pre><code>{
      "name": "PL_ADLS_RAW_IDMTables_DAILY",
      "properties": {
          "activities": [
              {
                  "name": "isStartDateNotNull",
                  "description": "If the startDate parameter == 0 then run the full load. If the startDate parameter != 0 then run for &gt;= startDate parameter.",
                  "type": "IfCondition",
                  "typeProperties": {
                      "expression": {
                          "value": "@equals(pipeline().parameters.startDate,'0')",
                          "type": "Expression"
                      },
                      "ifFalseActivities": [
                          {
                              "name": "copy_ENTITY_FULL",
                              "description": "Copies ENTITY from IDM Database to ADLS Raw Zone",
                              "type": "Copy",
                              "policy": {
                                  "timeout": "7.00:00:00",
                                  "retry": 0,
                                  "retryIntervalInSeconds": 60,
                                  "secureOutput": false,
                                  "secureInput": false
                              },
                              "typeProperties": {
                                  "source": {
                                      "type": "SqlSource",
                                      "sqlReaderQuery": {
                                          "value": "SELECT [ENTITY_ID],[ENTITY_TYPE_ID],REPLACE(REPLACE([SHORT_NAME], CHAR(13),' '), CHAR(10),' '),REPLACE(REPLACE([ENTITY_NAME], CHAR(13),' '), CHAR(10),' '),REPLACE(REPLACE([ENTITY_DESCRIPTION], CHAR(13),' '), CHAR(10),' '),REPLACE(REPLACE([STATUS], CHAR(13),' '), CHAR(10),' '),[STATUS_DATE],[REVISION_ID],[CREATED_BY],[CREATION_DATE],[LAST_UPDATED_BY],[LAST_UPDATE_DATE],REPLACE(REPLACE([COMMENTS], CHAR(13),' '), CHAR(10),' ') FROM [dbo].[ENTITY] where LAST_UPDATE_DATE &gt;= '@{formatDateTime(pipeline().parameters.startDate,'yyyy-MM-dd')}'",
                                          "type": "Expression"
                                      }
                                  },
                                  "sink": {
                                      "type": "AzureDataLakeStoreSink"
                                  },
                                  "enableStaging": false,
                                  "dataIntegrationUnits": 0
                              },
                              "inputs": [
                                  {
                                      "referenceName": "DS_IN_SQL_IDM_ENTITY",
                                      "type": "DatasetReference"
                                  }
                              ],
                              "outputs": [
                                  {
                                      "referenceName": "DS_OUT_ADLS_RAW_IDM_ENTITY",
                                      "type": "DatasetReference"
                                  }
                              ]
                          }
                      ],
                      "ifTrueActivities": [
                          {
                              "name": "copy_ENTITY",
                              "description": "Copies ENTITY from IDM Database to ADLS Raw Zone",
                              "type": "Copy",
                              "policy": {
                                  "timeout": "7.00:00:00",
                                  "retry": 0,
                                  "retryIntervalInSeconds": 60,
                                  "secureOutput": false,
                                  "secureInput": false
                              },
                              "typeProperties": {
                                  "source": {
                                      "type": "SqlSource",
                                      "sqlReaderQuery": {
                                          "value": "SELECT [ENTITY_ID],[ENTITY_TYPE_ID],REPLACE(REPLACE([SHORT_NAME], CHAR(13),' '), CHAR(10),' '),REPLACE(REPLACE([ENTITY_NAME], CHAR(13),' '), CHAR(10),' '),REPLACE(REPLACE([ENTITY_DESCRIPTION], CHAR(13),' '), CHAR(10),' '),REPLACE(REPLACE([STATUS], CHAR(13),' '), CHAR(10),' '),[STATUS_DATE],[REVISION_ID],[CREATED_BY],[CREATION_DATE],[LAST_UPDATED_BY],[LAST_UPDATE_DATE],REPLACE(REPLACE([COMMENTS], CHAR(13),' '), CHAR(10),' ') FROM [dbo].[ENTITY]",
                                          "type": "Expression"
                                      }
                                  },
                                  "sink": {
                                      "type": "AzureDataLakeStoreSink"
                                  },
                                  "enableStaging": false,
                                  "dataIntegrationUnits": 0
                              },
                              "inputs": [
                                  {
                                      "referenceName": "DS_IN_SQL_IDM_ENTITY",
                                      "type": "DatasetReference"
                                  }
                              ],
                              "outputs": [
                                  {
                                      "referenceName": "DS_OUT_ADLS_RAW_IDM_ENTITY",
                                      "type": "DatasetReference"
                                  }
                              ]
                          }
                      ]
                  }
              }
          ],
          "parameters": {
              "startDate": {
                  "type": "String"
              }
          }
      },
      "type": "Microsoft.DataFactory/factories/pipelines"
  }
  </code></pre>
  
  <h2>Trigger Source:</h2>
  
  <pre><code>{
      "name": "TR_SCHED_0800EST",
      "properties": {
          "description": "Daily 0800 EST",
          "runtimeState": "Stopped",
          "pipelines": [
              {
                  "pipelineReference": {
                      "referenceName": "PL_ADLS_RAW_IDMTables_DAILY",
                      "type": "PipelineReference"
                  },
                  "parameters": {
                      "startDate": "@trigger().scheduledTime"
                  }
              }
          ],
          "type": "ScheduleTrigger",
          "typeProperties": {
              "recurrence": {
                  "frequency": "Day",
                  "interval": 1,
                  "startTime": "2018-08-30T13:00:00Z",
                  "timeZone": "UTC",
                  "schedule": {
                      "minutes": [
                          0
                      ],
                      "hours": [
                          13
                      ]
                  }
              }
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <p>EDIT</p>
  
  <p>This works</p>
  
  <p><a href="https://i.stack.imgur.com/NRSaw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NRSaw.png" alt="enter image description here"></a></p>
  
  <p>This does not work</p>
  
  <p><a href="https://i.stack.imgur.com/BfTIz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BfTIz.png" alt="enter image description here"></a></p>