title: Azure Data Factory v2 If activity always fails
body: <p>I'm currently struggling with the Azure Data Factory v2 If activity which always fails with this error message:
  <a href="https://i.stack.imgur.com/EQXiF.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I've designed two separate pipelines, one takes the full snapshot of the data (1333 records) from the on-premises SQL Server and loads the data into the Azure SQL Database, and another one just takes delta from the same source.</p>
  
  <p>Both pipelines work fine when executed independently.</p>
  
  <p>I then decided to wrap these two pipelines into the one parent pipeline which would do this:
  1. 
  Execute LookUp activity to check if the target table in Azure SQL Database has any records, basic Select Count(Request_ID) As record_count From target_table - activity works fine, I can preview the returned record count.</p>
  
  <p>2.
  Pass the output from the LookUp activity to the If activity with the conditions that if record_count = 0, the parent pipeline would invoke the full load pipeline, otherwise the parent pipeline would invoke the delta load pipeline.</p>
  
  <p>This is the actual expression:<br>
  {@activity('lookup_sites_record_count').output.firstRow.record_count}==0"</p>
  
  <p>Whenever I try to execute this parent pipeline, it fails with the above message of "Activity  failed: Activity failed because an inner activity failed."</p>
  
  <p>Both inner activities, that is, full load and delta load pipelines, work just fine when triggered independently.</p>
  
  <p>What I'm missing?</p>
  
  <p>Many thanks in advance :).</p>
  
  <p>mikhailg</p>
  
  <p>Pipeline's JSON definition below:</p>
  
  <pre><code>{
  "name": "pl_remedyreports_load_rs_sites",
  "properties": {
      "activities": [
          {
              "name": "lookup_sites_record_count",
              "type": "Lookup",
              "policy": {
                  "timeout": "7.00:00:00",
                  "retry": 0,
                  "retryIntervalInSeconds": 30,
                  "secureOutput": false
              },
              "typeProperties": {
                  "source": {
                      "type": "SqlSource",
                      "sqlReaderQuery": "Select Count(Request_ID) As record_count From mdp.RS_Sites;"
                  },
                  "dataset": {
                      "referenceName": "ds_azure_sql_db_sites",
                      "type": "DatasetReference"
                  }
              }
          },
          {
              "name": "If_check_site_record_count",
              "type": "IfCondition",
              "dependsOn": [
                  {
                      "activity": "lookup_sites_record_count",
                      "dependencyConditions": [
                          "Succeeded"
                      ]
                  }
              ],
              "typeProperties": {
                  "expression": {
                      "value": "{@activity('lookup_sites_record_count').output.firstRow.record_count}==0",
                      "type": "Expression"
                  },
                  "ifFalseActivities": [
                      {
                          "name": "pl_remedyreports_invoke_load_sites_inc",
                          "type": "ExecutePipeline",
                          "typeProperties": {
                              "pipeline": {
                                  "referenceName": "pl_remedyreports_load_sites_inc",
                                  "type": "PipelineReference"
                              }
                          }
                      }
                  ],
                  "ifTrueActivities": [
                      {
                          "name": "pl_remedyreports_invoke_load_sites_full",
                          "type": "ExecutePipeline",
                          "typeProperties": {
                              "pipeline": {
                                  "referenceName": "pl_remedyreports_load_sites_full",
                                  "type": "PipelineReference"
                              }
                          }
                      }
                  ]
              }
          }
      ],
      "folder": {
          "name": "Load Remedy Reference Data"
      }
  }
  </code></pre>
  
  <p>}</p>