Azure data factory read text file , based on value trigger another pipeline

vsivas 41 Reputation points
2021-03-19T17:05:22.497+00:00

Adf pipeline activity need to

  1. read text file from storage
  2. extract value and based on value
  3. trigger another pipeline
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,877 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 23,816 Reputation points Microsoft Employee
    2021-03-22T22:31:45.69+00:00

    anonymous user Thanks for using Microsoft Q&A !!

    You can use -

    1. Lookup activity first to fetch the records and
    2. Then use ForEach Activity to traverse through the returned result set
    3. Inside For Each Activity you can use the IF Condition activity to execute another pipeline using Execute Pipeline trigger.

    Please refer to the below Gif.
    80403-adf-readtextfile.gif

    Also sharing pipeline code for your reference, if this helps

    {  
        "name": "pl_read_text_trigger_childPipeline",  
        "properties": {  
            "activities": [  
                {  
                    "name": "Lookup1",  
                    "type": "Lookup",  
                    "dependsOn": [],  
                    "policy": {  
                        "timeout": "7.00:00:00",  
                        "retry": 0,  
                        "retryIntervalInSeconds": 30,  
                        "secureOutput": false,  
                        "secureInput": false  
                    },  
                    "userProperties": [],  
                    "typeProperties": {  
                        "source": {  
                            "type": "DelimitedTextSource",  
                            "storeSettings": {  
                                "type": "AzureBlobStorageReadSettings",  
                                "recursive": true,  
                                "enablePartitionDiscovery": false  
                            },  
                            "formatSettings": {  
                                "type": "DelimitedTextReadSettings"  
                            }  
                        },  
                        "dataset": {  
                            "referenceName": "txtDestination",  
                            "type": "DatasetReference"  
                        },  
                        "firstRowOnly": false  
                    }  
                },  
                {  
                    "name": "ForEach1",  
                    "type": "ForEach",  
                    "dependsOn": [  
                        {  
                            "activity": "Lookup1",  
                            "dependencyConditions": [  
                                "Succeeded"  
                            ]  
                        }  
                    ],  
                    "userProperties": [],  
                    "typeProperties": {  
                        "items": {  
                            "value": "@activity('Lookup1').output.value",  
                            "type": "Expression"  
                        },  
                        "activities": [  
                            {  
                                "name": "If Condition1",  
                                "type": "IfCondition",  
                                "dependsOn": [],  
                                "userProperties": [],  
                                "typeProperties": {  
                                    "expression": {  
                                        "value": "@equals(item().ID,'3')",  
                                        "type": "Expression"  
                                    },  
                                    "ifTrueActivities": [  
                                        {  
                                            "name": "Execute Pipeline1",  
                                            "type": "ExecutePipeline",  
                                            "dependsOn": [],  
                                            "userProperties": [],  
                                            "typeProperties": {  
                                                "pipeline": {  
                                                    "referenceName": "pl_childPipeline",  
                                                    "type": "PipelineReference"  
                                                },  
                                                "waitOnCompletion": true,  
                                                "parameters": {  
                                                    "waitTime": {  
                                                        "value": "3",  
                                                        "type": "Expression"  
                                                    }  
                                                }  
                                            }  
                                        }  
                                    ]  
                                }  
                            }  
                        ]  
                    }  
                }  
            ],  
            "annotations": []  
        }  
    }  
    

    ----------

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.