ADF - How to copy file value into pipeline variable

Abhilash Sadhale 21 Reputation points
2021-12-28T12:07:01.867+00:00

I am getting two files from source system,

  1. One file with actual data
  2. Second file with number of rows in first file

The second file will be used for file validation purpose. I need to read second file which only has number of records value. For example, if first file has 1000 records second file will only have number '1000'. I need to read this number from second file which client has sent and then need to compare this number with count of data loaded in target table. The comparison will take place in stored proc, so I need to send this number '1000' as a parameter.

Is there any way to assign the file data value into a pipeline variable?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,380 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,655 questions
0 comments No comments
{count} votes

Accepted answer
  1. ShaikMaheer-MSFT 38,551 Reputation points Microsoft Employee Moderator
    2021-12-28T16:10:24.357+00:00

    Hi @Abhilash Sadhale ,

    Thank you for posting query in Microsoft Q&A Platform.

    You can read content of your file using Lookup activity and then use Set Variable activity to set the value of count in to your variable.

    Below example implements same.

    Lookup activity to read file:
    160917-image.png

    Set Variable activity:
    160886-image.png

    Hope this will help. Please let us know if any further queries.

    ---------
    Please consider hitting Accept Answer button. Accepted answers helps community as well.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Nandan Hegde 36,156 Reputation points MVP Volunteer Moderator
    2021-12-28T12:29:57.333+00:00

    Hey, You can use lookup activity to read that value from file and assign the output of lookup activity to a variable via set variable activity

    https://stackoverflow.com/questions/69444885/in-azure-data-factory-how-to-see-output-data-for-a-lookup-activity-in-debug-mod

    https://stackoverflow.com/questions/67404483/azure-data-factory-not-able-to-retrieve-json-lookup-activity-out-put-when-jso

    mssqltips.com/sqlservertip/6185/azure-data-factory-lookup-activity-example/

    1 person found this answer helpful.
    0 comments No comments

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.