community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Date Filter in Mongo Input

Asteroid

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

Moderator
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:

 

LLjGFJL

 

2. Wrap MongoDB Input up as a batch macro by adding a Control Parameter, and point the Action tool to update the 'Filter' field:

 

dObFsKi

Sophia Fraticelli
Customer Support Engineer
Alteryx, Inc.
Asteroid

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

Moderator
Moderator

Looks good - now you just need to make a workflow that includes both macros:

 

xBotks3

 

 

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.

Sophia Fraticelli
Customer Support Engineer
Alteryx, Inc.
Asteroid

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.

Moderator
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()

 

Sophia Fraticelli
Customer Support Engineer
Alteryx, Inc.
Asteroid

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

Labels