Hi team,
Working on a query for action button attached to text box and mongo db tool.
I have formulated query for mongo db tool as attached below . But facing issues in creating a query for action tool, where #1 and #2 are dates, but now I have call multiple commas separated fields for #3 as updated in mogo db query already.
Comma separated field will look like – “Bin Fut 9:59:59 PM,Bitfin 10:59:59 AM,Blberg” . What should be updated while replacing #3 in action tool .
Hi @Sanskriti22,
If you're passing multiple comma-separated values (e.g., from a Text Box input like "Bin Fut 9:59:59 PM,Bitfin 10:59:59 AM,Blberg") into a MongoDB $in array via the Action Tool, you'll need to format those values properly as a JSON array.
Here’s how you can do it:
Replace(
Replace(
Replace([Destination], "2024-01-01", ToString([#1])),
"2024-01-02", ToString([#2])
),
"ABC", '["' + Replace(ToString([#3]), ",", '","') + '"]'
)
What it does:
This ensures your Mongo query receives a valid $in array when the Action Tool updates the query string.
Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀[Explore More]
I might have missed to mention this earlier csv field will called as it is but data in database is in tabular format for #3 - such as
Source
Bin Fut 9:59:59 PM
Bitfin 10:59:59 AM
Blberg
If i am taking above mentioned than mongo db query attached will not work - {"DateAndTime": { "$gte" : { "$date" : "2025-05-08T00:00:00.000+0000"} } },{ "DateAndTime": { "$lte" : { "$date" : "2025-05-08T00:00:00.000+0000"} } },{"Source":{ "$in": ["ABC", "XYZ", "DEF"] }
I will get multiple row item to be called from source column but those multiple columns are comma separated format for query of action tool .
I hope this will make issue more clear .
Hi @Sanskriti22,
Thanks for the clarification — now I see the #3 input is coming from a column of values (multi-row), not a single comma-separated string.
Here’s how to make that work:
'["' + [Concatenated_Source] + '"]'
3. Connect that into your Action Tool, and replace "ABC" (or whatever placeholder you're using) in your Mongo query with this formatted array.
This will give you the correct $in array format like: ["Bin Fut 9:59:59 PM","Bitfin 10:59:59 AM","Blberg"]
⭐Hope this solution helps you make the most of Alteryx! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together! 🚀 [Explore more]