ADF - Dynamic content with variable

Sword55 1 Reputation point
2021-11-04T19:57:10.42+00:00

Hello,

This works fine below......I want to replace the -90 with a parameter value like so... "pipeline().parameters.P_DaysToGoBack"

@formatdatetime(
adddays(
converttimezone(
utcnow()
,'UTC'
,'Eastern Standard Time'
)
,-90 )
,'yyyy-MM-dd hh:mm:ss'
)

Thanks
GV

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

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,737 Reputation points Microsoft Employee Moderator
    2021-11-05T08:17:15.447+00:00

    Hi @Sword55 ,

    Welcome to Microsoft Q&A forum and thanks for your query.

    Please try below expression and it should help achieve your requirement.

    @formatdatetime(adddays(converttimezone(utcnow(),'UTC','Eastern Standard Time'),int(concat('-', string(pipeline().parameters.P_DaysToGoBack)))),'yyyy-MM-dd hh:mm:ss')  
    

    Another approach is you need to use the below expression and pass the parameter/variable value as negative integer (-90):

    146726-image.png

    @formatdatetime(adddays(converttimezone(utcnow(),'UTC','Eastern Standard Time'),pipeline().parameters.P_DaysToGoBack ),'yyyy-MM-dd hh:mm:ss')  
    

    Hope this helps. Do let us know if you have further query.

    ----------

    • Please don't forget to click on 130616-image.png and upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

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.