Share via

Set variable

Anshal 2,251 Reputation points
2022-07-07T12:57:00.66+00:00

Hi friends I am very confusing using set variable I need good example practical to understand help please I already read documents but still not clear

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


Answer accepted by question author

Subashri Vasudevan 11,306 Reputation points Volunteer Moderator
2022-07-07T15:49:11.64+00:00

Hi @Anshal ,

In addition to what @Nandan Hegde mentioned, some of the use cases that I know are below.

  1. Declare and Initialise a string or Boolean variable with true and use it in an until loop and based on some condition, update it to false and terminate the loop based on that variable value. Reference
  2. Assigning an activity output or activity error message and writing it to a file or database table.
  3. Write an expression like formatdatetime(utcnow(),'yyyy-MM-dd') and assign it to a variable and use it in any number of activities to avoid repeating same expression.

Will add more use cases as and when I recollect.

Thanks.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Nandan Hegde 36,886 Reputation points MVP Volunteer Moderator
    2022-07-07T13:44:23.277+00:00

    Intro:https://learn.microsoft.com/en-us/azure/data-factory/control-flow-set-variable-activity

    video:
    https://www.youtube.com/watch?v=rzDZdRifC40

    use case:
    https://azurede.com/2021/09/25/azure-data-factory-increment-variable-using-set-variable-activity/

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

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