Row to column

Vineet S 1,390 Reputation points
2024-08-08T18:15:09.56+00:00

Hi How to convert rows into column and use in lookup Table1- 0 Table2-1 above table contains one column and has 2 rows. If 0 then pipline should not load or else load... How to skip that table load when 0..pls share screenshot

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,637 questions
0 comments No comments
{count} votes

Accepted answer
  1. Amira Bedhiafi 33,476 Reputation points Volunteer Moderator
    2024-08-08T21:53:51.59+00:00

    Assuming you have a source dataset with a structure similar to this:

    TableName LoadFlag
    Table 1 0
    Table 2 1

    To pivot the rows into columns, you can use a Mapping Data Flow :

    1. Add a Source Transformation:
      • Add a source dataset that points to the table containing the TableName and LoadFlag columns.
    2. Add a Pivot Transformation:
      • In the Data Flow, add a Pivot Transformation.
      • Set the "Pivot key" to TableName.
      • Set the "Pivoted column" to LoadFlag.
      • For the "Aggregate function," you can use max() or min() to ensure that the column values are correctly aggregated.
      This will transform the rows into columns like :
    Table 1 Table 2
    0 1

    After transforming your data, use a Lookup Activity to query the pivoted table to check the values of Table1, Table2...

    1. Use an If Condition:
      • Use an If Condition Activity in the pipeline after the Lookup to evaluate whether the LoadFlag for a particular table is 0 or 1.
      • Example Expression: @equals(activity('LookupActivityName').output.firstRow.Table1, 1)
    2. Set Up Pipeline Execution Based on Condition:
      • If the condition evaluates to true, proceed to load the table.
      • If false, skip the loading process.
    0 comments No comments

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.