11-24-2022 09:56 AM
Hi All,
I have a requirement to pass date in YYYY-MM-DD format and I am using the expression “Date.now().toLocaleDateString()” but I have the below issue.
When I use it in pipeline parameter “Effective_Date” then use _Effective_Date in the pipeline it fails but when I use it directly it works. When I pass something hardcoded in the pipeline parameter it also works e.g. 2022-01-01
Could you suggest what is happening here and what is needed to get it fixed?
Below is not working
Below is working
Solved! Go to Solution.
11-25-2022 07:10 AM
When you need to run the pipeline with earlier dates, is it going to be a manual configuration and run?
You can simply configure the BatchParameterD1 like this:
_Effective_Date == "" ? Date.now().toLocaleDateString() : _Effective_Date
That way, if the parameter is not empty, it will be taken into consideration, if it is, than the current date will be generated.
11-24-2022 10:46 AM
Can anyone suggest, please?
11-24-2022 01:54 PM
Hi, can anyone suggest me a workaround, please?
11-24-2022 10:31 PM
Hi @amit.saroha,
The values that are passed from parameters, are always a string. So in your case, you’re not passing a function, but a string.
In order your pipeline to work is, either leave the BatchParameter to get the date directly from the pipeline execute like shown on the picture above, or, use the eval() function with the parameter.
eval(_Effective_Date)
That way your function passed like a parameter, will be evaluated and considered as a function.
Hope this helps,
Bojan
11-25-2022 06:32 AM
Thanks @bojanvelevski - It works but when I pass 2022-11-20 in same parameter instead of expression the eval (Effective_Date) returns 1991 but I need it as it is 2022-11-20.
Please suggest if there is a way to do it, I want both the options working.