none
passing parameter -- urgent help

    Question

  • Need to pass lookup value to another pipeline as main pararmeter under array?
    P2  = Lookup + p1  (In parameter, created a name called gtname and passing value i.e   @activity('Lookup').output.Value[0].tname
    In P1  pipeline having main parameter called A1 as array and it has default values with  json script, in that json script i need to call the above gtname lookup parameter
    how to achieve this?



    Tuesday, November 6, 2018 5:12 PM

All replies

  • Hello,

    Do you have any code snippets you could share?

    Tuesday, November 6, 2018 6:51 PM
    Moderator
  • {
    "name": "pipeline10",
    "properties": {
    "activities": [
    {
    "name": "Lookup1",
    "type": "Lookup",
    "policy": {
    "timeout": "7.00:00:00",
    "retry": 0,
    "retryIntervalInSeconds": 30,
    "secureOutput": false,
    "secureInput": false
    },
    "typeProperties": {
    "source": {
    "type": "SqlSource",
    "sqlReaderQuery": "select tname,tcol from duplicatedetect"
    },
    "dataset": {
    "referenceName": "lookup",
    "type": "DatasetReference"
    },
    "firstRowOnly": false
    }
    },
    {
    "name": "Execute Pipeline1",
    "type": "ExecutePipeline",
    "dependsOn": [
    {
    "activity": "Lookup1",
    "dependencyConditions": [
    "Succeeded"
    ]
    }
    ],
    "typeProperties": {
    "pipeline": {
    "referenceName": "pipeline9",
    "type": "PipelineReference"
    },
    "parameters": {
    "gtname": "\n@activity('Lookup1').output.Value[0].tname",
    "gtcol": "@activity('Lookup1').output.Value[0].tcol"
    }
    }
    }
    ]
    }
    }

    {
    "name": "pipeline9",
    "properties": {
    "activities": [
    {
    "name": "ForEach_6hh",
    "type": "ForEach",
    "typeProperties": {
    "items": {
    "value": "@pipeline().parameters.cw_items",
    "type": "Expression"
    },
    "activities": [
    {
    "name": "Copy_zy3",
    "type": "Copy",
    "policy": {
    "timeout": "7.00:00:00",
    "retry": 0,
    "retryIntervalInSeconds": 30,
    "secureOutput": false,
    "secureInput": false
    },
    "userProperties": [
    {
    "name": "Source",
    "value": "@{item().source.entityName}"
    },
    {
    "name": "Destination",
    "value": "@{item().destination.tableName}"
    }
    ],
    "typeProperties": {
    "source": {
    "type": "DynamicsSource",
    "query": {
    "value": "@item().copySource.query",
    "type": "Expression"
    }
    },
    "sink": {
    "type": "SqlSink",
    "writeBatchSize": 10000,
    "preCopyScript": ""
    },
    "enableStaging": false,
    "dataIntegrationUnits": 0
    },
    "inputs": [
    {
    "referenceName": "SourceDataset_6hh",
    "type": "DatasetReference",
    "parameters": {
    "cw_structure": "@item().source.structure",
    "cw_entityName": "@item().source.entityName"
    }
    }
    ],
    "outputs": [
    {
    "referenceName": "DestinationDataset_6hh",
    "type": "DatasetReference",
    "parameters": {
    "cw_structure": "@item().destination.structure",
    "cw_tableName": "@item().destination.tableName"
    }
    }
    ]
    },
    {
    "name": "Stored Procedure1",
    "type": "SqlServerStoredProcedure",
    "dependsOn": [
    {
    "activity": "Copy_zy3",
    "dependencyConditions": [
    "Succeeded"
    ]
    }
    ],
    "policy": {
    "timeout": "7.00:00:00",
    "retry": 0,
    "retryIntervalInSeconds": 30,
    "secureOutput": false,
    "secureInput": false
    },
    "typeProperties": {
    "storedProcedureName": "[dbo].[deleterowremove1]"
    },
    "linkedServiceName": {
    "referenceName": "AzureSqlDatabaseuat",
    "type": "LinkedServiceReference"
    }
    }
    ]
    }
    }
    ],
    "parameters": {
    "cw_items": {
    "type": "Array",
    "defaultValue": [
    {
    "source": {
    "structure": [
    {
    "name": "@item().gtname",
    "type": "Guid"
    }
    ],
    "entityName": "@item().gtcol"
    },
    "destination": {
    "structure": [
    {
    "name": "accountid",
    "type": "Guid"
    }
    ],
    "tableName": "[dbo].[delacctid]"
    },
    "copySource": {
    "query": "<fetch>\n<entity name=\"@item().gtname\">\n <attribute name=\"accountid\" />\n \n</entity>\n</fetch>\n"
    },
    "copyActivity": {
    "translator": {
    "type": "TabularTranslator",
    "columnMappings": {
    "@activity('Lookup1').output.Value[0].tcol": "accountid"
    }
    }
    }
    }
    ]
    },
    "gtname": {
    "type": "String",
    "defaultValue": "account"
    },
    "gtcol": {
    "type": "String",
    "defaultValue": "accountid"
    }
    }
    },
    "type": "Microsoft.DataFactory/factories/pipelines"
    }

    pipeline 10  parameter gtname, gtcol need to pass into pipeline 9 under Cw_item array 

    Tuesday, November 6, 2018 7:20 PM
  • There should not be item() in cw_items.

    I guess @activity('Lookup1').output.Value is an array, each item contains tname and tcol.

    If so, you need to pass @activity('Lookup1').output.Value into pipeline9, and pass it to "items" of foreach activity. 

    Then use item().tname or item().tcol in the inside copy activity to parameterize.

    Here is an example about how to use lookup and foreach activities: https://docs.microsoft.com/en-us/azure/data-factory/tutorial-bulk-copy-portal

    Wednesday, November 7, 2018 3:17 AM