Default values for parameter linked to Dataset field


Parameter is pointing to Year, a field in dataset.
How can I default the parameter to value of current year?
Or even multiple values of current year AND previous year?

Thanks!

Hey @lbl

This looks like you are using a String/Number parameter. In the past to make it easier I have just added the defaults manually. Since its at the year level I would just go back an update it on December 31.

@duncan
this is hard-coding. any way to dynamically set the default based on current date?
thanks.

Hey @lbl

To make this dynamic rather than hard coded you will have to complete more steps. This topic covers a similar use case:

@duncan
Thanks, I have given my comments in that post.

Hi @lbl,
You can set a default date using a date parameter only:

String’s are setup to have static information, they do not have the ability to recognize that it’s gathering years from a date field and therefore default to a current year. Setting up a static default is your only way when using a string for your parameter.

I’ve suggested a feature request to utilize date fields differently in parameters for different instances like this, where a date picker would not be helpful. I will tag this as a feature request to promote visibility to this type of scenario where that feature would come in handy.