Date Filter in Mongo Input
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Everyone,
We face an issue with pulling data from Mongo database everyday as we have to give a criteria everytime which is not in a date format and have to run a separate workflow everytime just to get those date filters in a format compatible with Mongo Input criteria.
I am attaching the steps we follow with respective screenshots for better understanding the problem. Would be great if someone could help out with a better way as we want to automate this task rather than running daily manually.
Regards,
Rushabh
Solved! Go to Solution.
- Labels:
- MongoDB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You could extend the macro you have to create the criteria in Alteryx, then wrap the MongoDB Input in a macro that dynamically updates the criteria field.
1. Add a formula to build the criteria input from your values:
2. Wrap MongoDB Input up as a batch macro by adding a Control Parameter, and point the Action tool to update the 'Filter' field:
Senior Solutions Architect
Alteryx, Inc.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you so much Sophia. I tried following your steps but since I am pretty new to using Mongo DB input I require some mor ehelp.
Please have a look at the attachment and see if you can help me out.
Regards,
Rushabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Looks good - now you just need to make a workflow that includes both macros:
Now when you run this, it will run the first macro to create the criteria, and then the second input will take that criteria and apply it to your MongoDB Input. However, since the macro doesn't do anything else, it will end there. You will either want to output the results of that second macro by adding a Macro Output tool, or build out the rest of your process within the second macro - it's up to you.
Senior Solutions Architect
Alteryx, Inc.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Sophia,
It worked. Thank you so much for the guidance. Just one last question.
Is there anyway we can make the start and end date dynamic in the first macro input.. Attaching the screenshot to explain what I am talking about.
Regards,
Rushabh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can use a formula after the text input - here are some examples:
Yesterday's date:
DateTimeAdd(DateTimeToday(),-1,'days')
Today's date:
DateTimeToday()
Senior Solutions Architect
Alteryx, Inc.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yup.. It struck me after posting that it was a stupid doubt.
But Thanks alot Sophia for all the help. It will help me save Time & efforts.
Regards,
Rushabh
