I’m querying databases using SQL Creator and have a Where clause date > ‘$(dateuserparameter)’. I would like the dateuserparameter default value to be yesterday’s date, for example ‘2024-10-07’. Is it possible to set the parameter’s default value to be yesterday’s date?
Solved
Is it possible for a user parameter to default to today's date?
Best answer by david_r
Great suggestion by
from datetime import datetime, timedelta
import fme
user_input = fme.macroValues.get("dateuserparameter")
if user_input:
return user_input
else:
yesterday = datetime.now() - timedelta(1)
yesterday_str = yesterday.strftime('%Y-%m-%d')
return yesterday_strYou can then reference this scripted parameter in your SQLCreator. It will return the user input, if available, otherwise yesterdays date.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.









