Share via

Function inside a Variable?

Dirk Sachse 131 Reputation points
2022-01-05T10:54:20.637+00:00

Is it possible to use a function inside of a variable?

I need this inside of a variable named "requestBody":

@concat('Test ', formatDateTime(utcNow(),'yyyy-MM-dd'),' URL')

And I want to use it as dynamic content like this:

@variables('requestBody')

It should resolve to this string, which I need in the Request body field of a POST method in a Copy data activity:

 Test 2022-01-05 URL
Azure Data Factory
Azure Data Factory

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


Answer accepted by question author

ShaikMaheer-MSFT 38,631 Reputation points Microsoft Employee Moderator
2022-01-07T18:02:11.12+00:00

HI @Dirk Sachse ,

Thanks for posting query in Microsoft Q&A Platform.

If I understood your ask better then you want to have expression as a string in SQL. Read that expression as string in to ADF and in ADF convert that string in to expression.

Sadly, this is not possible at this moment in pipeline expressions. But, converting string and to expression is possible using expr() function in ADF data flows.

So, if your requirement suits in dataflows, then consider using dataflows for your case.

Please check below video, where its explained using expr() function to convert string to expression.
https://www.youtube.com/watch?v=Dssph_O5cVQ&list=PLMWaZteqtEaLacN3eS3s8pw2jtwBVb1BH&index=34

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

-----------------

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

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Nandan Hegde 36,886 Reputation points MVP Volunteer Moderator
    2022-01-05T11:20:09.42+00:00

    Hey,
    Can you please clear your requirement :
    Is the below output that you are expecting dynamically:
    162531-image.png

    Then use the below expression (slight correction to the one you provided)

    @concat('Test ',formatDateTime(utcNow(),'yyyy-MM-dd'),' URL')  
    

    Was this answer helpful?


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.