Replacing Variable with value of a pipeline variable in DataFactory

Bert Natenstedt 1 Reputation point


 In my Azure DataFactory project I need to replace a part of a string with the value of a pipeline variable.

The string is received from a Record in a table source and contains something like this:  ....Fieldname eq {variables('testValue')} 
Conform ADF documentation I think the part between{} should be evaluated by ADF and should be replace by the value of the variable testValue

(I Used this example as test in a set variable action in ADF).

But at this moment in in the debug exactly the string as received from the record is returned. 
It looks like that ADF can't interprete the string as string interpolation when the string is added from a previous activity

Is my assumption correct or is there a solution ?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,490 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 30,601 Reputation points Microsoft Employee

    @Bert Natenstedt ,

    Welcome to Microsoft Q&A platform and thanks for posting your question here.

    As I understand your query, you want to replace the string '{variables('testValue')}' to the value holded by variable. For this you tried using set variable activity , however, adf is returning the same input string as output. Please let me know if that is not the correct understanding.

    I tried to reproduce your case, it looks like the symbols are not being treated as a valid string when we use replace function .

    The workaround I would suggest is to remove all the symbols by the following expression

    and then replace the remaining string variables(testValue) with the variable value.

    So here is the reference video of the pipeline.

    1. Use lookup activity to fetch the table content
    2. Associate two set variable activities with it. First one referencing var1 with this expresion:

    And second set variable referencing var2 having the value you specified , say, 'GUID'

    1. Add another set variable activity to replace 'variables(testValue)' with 'GUID'


    Hope it helps. Please accept the answer and mark it as helpful. Thanks