question

arkiboys avatar image
0 Votes"
arkiboys asked arkiboys commented

parameter default value

Hello,
One of the pipeline parameter is pDate which I pass in manually each time I want o run the pipeline.
Is there a way to set the default of this parameter of the pipeline to be today's date?
When I hover over the textbox, I do not get a link for dynamic content.
Thank you

azure-data-factory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ShaikMaheer-MSFT avatar image
0 Votes"
ShaikMaheer-MSFT answered arkiboys commented

Hi @arkiboys ,

Thank you for posting query on Microsoft Q&A Platform.

Parameters will not accept expressions as default value. So with parameter you cannot achieve getting current datetime as default value using utcnow() function.


You can consider having a variable for this requirement. For variable you can pass @{utcnow()} as default value that will set current date time vaule in that variable.

In below example, I created two variables "currentDateTimeVar" & "var2". I am setting default value for "currentDateTimeVar" as @{utcnow()}.
Now, using set variable activity I am trying to pass value of "currentDateTimeVar" in to "var2". This will help me to know @{utcnow()} function actually storing value in to "currentDateTimeVar" variable or not.

131699-variabledefault.gif

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


  • Please don't forget to click on 130616-image.png or 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




variabledefault.gif (662.8 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @arkiboys ,

Just checking in to see if the above answer helped. If this answers your query, do click Accept Answer and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·
arkiboys avatar image arkiboys ShaikMaheer-MSFT ·

Thank you

0 Votes 0 ·
NandanHegde-7720 avatar image
0 Votes"
NandanHegde-7720 answered NandanHegde-7720 commented

Hey,
Unfortunately based on my understanding that is not possible.
So rather than referring your original parameter in your downstream queries, you can leverage a variable.

And that variable value would be parameter value which is passed out and it can be utcnow() in case if it is null.
And you can check whether a parameter is null by using equals and coalesce functions.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

can you let me know how to do this by an example?
Thank you

0 Votes 0 ·

Hey,
You can use the below expression:

 @if(equals(coalesce(pipeline().parameters.Test,'0'),'0'),utcnow(),pipeline().parameters.Test)

where pipeline().parameters.Test is the pipeline parameter

The above expression defines that in case if no specific parameter value is passed take utcnow else take the passed parameter value.

You can assign this expression to a variable in a set variable activity and leverage that variable in further activities rather than using the parameter value. (thereby achieving the goal)

Hope this clarifies :)

0 Votes 0 ·